Skip to content

Commit

Permalink
Update creature.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Luffy117 authored Dec 9, 2024
1 parent 6fab35f commit cc81ae2
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions src/creature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,56 +636,56 @@ export class Creature {
}

const defaultOptions = {
targeting: false,
noPath: false,
isAbility: false,
ownCreatureHexShade: true,
range: game.grid.getMovementRange(this.x, this.y, remainingMove, this.size, this.id),
callback: function (hex: Hex, args) {
if (hex.x == args.creature.x && hex.y == args.creature.y) {
// Prevent null movement
game.activeCreature.queryMove();
return;
}
targeting: false,
noPath: false,
isAbility: false,
ownCreatureHexShade: true,
range: game.grid.getMovementRange(this.x, this.y, remainingMove, this.size, this.id),
callback: function (hex: Hex, args) {
if (hex.x == args.creature.x && hex.y == args.creature.y) {
// Prevent null movement
game.activeCreature.queryMove();
return;
}

if (game.grid.materialize_overlay) {
const creature = game.retrieveCreatureStats(game.activeCreature.type);
game.Phaser.add
.tween(game.grid.materialize_overlay)
.to(
{
alpha: 0,
},
creature.animation.walk_speed,
Phaser.Easing.Linear.None,
)
.start();
}
if (game.grid.materialize_overlay) {
const creature = game.retrieveCreatureStats(game.activeCreature.type);
game.Phaser.add
.tween(game.grid.materialize_overlay)
.to(
{
alpha: 0,
},
creature.animation.walk_speed,
Phaser.Easing.Linear.None,
)
.start();
}

game.gamelog.add({
action: 'move',
game.gamelog.add({
action: 'move',
target: {
x: hex.x,
y: hex.y,
},
});
if (game.multiplayer) {
game.gameplay.moveTo({
target: {
x: hex.x,
y: hex.y,
},
});
if (game.multiplayer) {
game.gameplay.moveTo({
target: {
x: hex.x,
y: hex.y,
},
});
}
game.UI.btnDelay.changeState('disabled');
args.creature.moveTo(hex, {
animation: args.creature.movementType() === 'flying' ? 'fly' : 'walk',
callback: function () {
game.activeCreature.queryMove();
},
});
},
}
game.UI.btnDelay.changeState('disabled');
args.creature.moveTo(hex, {
animation: args.creature.movementType() === 'flying' ? 'fly' : 'walk',
callback: function () {
game.activeCreature.queryMove();
},
});
},
},
// overwrite any fields of `defaultOptions` that were provided in `options`
o = $j.extend(defaultOptions, options);

Expand Down Expand Up @@ -730,7 +730,7 @@ export class Creature {
fnOnConfirm: function () {
game.UI.btnSkipTurn.click();
},
fnOnCancel: function () {},
fnOnCancel: function () { },
confirmText: 'Skip turn',
});
} else {
Expand Down Expand Up @@ -1915,8 +1915,8 @@ class CreatureSprite {
(dir === 1
? this._frameInfo.originX
: HEX_WIDTH_PX * this._creatureSize -
this._sprite.texture.width -
this._frameInfo.originX) +
this._sprite.texture.width -
this._frameInfo.originX) +
this._sprite.texture.width / 2;
this._healthIndicatorSprite.x = dir === -1 ? 19 : 19 + HEX_WIDTH_PX * (this._creatureSize - 1);
this._healthIndicatorText.x =
Expand Down

0 comments on commit cc81ae2

Please sign in to comment.