From 93583f5fa8baf6069c0e066b3aa9cd0b6882f20d Mon Sep 17 00:00:00 2001 From: Dread Knight Date: Tue, 10 Dec 2024 03:13:41 +0200 Subject: [PATCH] Revert "Upgrade Abolished's Third Ability: Bonfire Spring" --- src/abilities/Abolished.js | 16 +++---- src/creature.ts | 91 +++++++++++++++++++------------------- src/game.ts | 19 +++----- 3 files changed, 57 insertions(+), 69 deletions(-) diff --git a/src/abilities/Abolished.js b/src/abilities/Abolished.js index 821f10446..9366b71b5 100644 --- a/src/abilities/Abolished.js +++ b/src/abilities/Abolished.js @@ -4,7 +4,6 @@ import { Creature } from '../creature'; import { Effect } from '../effect'; import * as arrayUtils from '../utility/arrayUtils'; import { getPointFacade } from '../utility/pointfacade'; -import { isUndefined } from 'underscore'; /** Creates the abilities * @param {Object} G the game object @@ -211,24 +210,19 @@ export default (G) => { { // Type : Can be "onQuery", "onStartPhase", "onDamage" trigger: 'onQuery', - range: 3, + range: 6, require() { return this.testRequirements(); }, - query() { const ability = this; const crea = this.creature; - let totalRange = this.range; - if (this.isUpgraded()) { - totalRange = this.range + this.creature.accumulatedTeleportRange - 1; - } // Relocates to any hex within range except for the current hex crea.queryMove({ noPath: true, isAbility: true, - range: G.grid.getFlyingRange(crea.x, crea.y, totalRange, crea.size, crea.id), + range: G.grid.getFlyingRange(crea.x, crea.y, this.range, crea.size, crea.id), callback: function (hex, args) { if (hex.x == args.creature.x && hex.y == args.creature.y) { // Prevent null movement @@ -243,7 +237,11 @@ export default (G) => { activate(hex) { const ability = this; ability.end(); - this.creature.accumulatedTeleportRange = 0; + + if (this.isUpgraded()) { + this.range += 1; + } + const targets = ability.getTargets(ability.creature.adjacentHexes(1)); targets.forEach(function (item) { diff --git a/src/creature.ts b/src/creature.ts index 70f96b497..2cec8a6a0 100644 --- a/src/creature.ts +++ b/src/creature.ts @@ -160,7 +160,6 @@ export class Creature { oldEnergy: number; remainingMove: number; abilities: Ability[]; - accumulatedTeleportRange: number = 0; // Used for Abolished's third ability creatureSprite: CreatureSprite; @@ -636,56 +635,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', - target: { - x: hex.x, - y: hex.y, - }, - }); - if (game.multiplayer) { - game.gameplay.moveTo({ + game.gamelog.add({ + action: 'move', 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(); - }, - }); + 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(); + }, + }); + }, }, - }, // overwrite any fields of `defaultOptions` that were provided in `options` o = $j.extend(defaultOptions, options); @@ -730,7 +729,7 @@ export class Creature { fnOnConfirm: function () { game.UI.btnSkipTurn.click(); }, - fnOnCancel: function () { }, + fnOnCancel: function () {}, confirmText: 'Skip turn', }); } else { @@ -1915,8 +1914,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 = diff --git a/src/game.ts b/src/game.ts index 6d2afab90..500947044 100644 --- a/src/game.ts +++ b/src/game.ts @@ -322,7 +322,7 @@ export default class Game { setupOpt: Partial, matchInitialized?: boolean, matchid?: number, - onLoadCompleteFn = () => { }, + onLoadCompleteFn = () => {}, ) { // Need to remove keydown listener before new game start // to prevent memory leak and mixing hotkeys between start screen and game @@ -902,7 +902,7 @@ export default class Game { o = $j.extend( { - callback: function () { }, + callback: function () {}, noTooltip: false, tooltip: 'Skipped', }, @@ -963,7 +963,7 @@ export default class Game { o = $j.extend( { - callback: function () { }, + callback: function () {}, }, o, ); @@ -1260,7 +1260,7 @@ export default class Game { onStartPhase(/* creature, callback */) { const creature = arguments[0], totalTraps = this.traps.length; - + let trap: Trap; for (let i = 0; i < totalTraps; i++) { @@ -1293,10 +1293,6 @@ export default class Game { // Removed individual args from definition because we are using the arguments variable. onEndPhase(/* creature, callback */) { const creature = arguments[0]; - // Check if Abolished used third ability - if (creature.abilities.some(ability => ability.title === 'Bonfire Spring')) { - creature.accumulatedTeleportRange += 1; - } this.triggerDeleteEffect('onEndPhase', creature); this.triggerAbility('onEndPhase', arguments); @@ -1507,7 +1503,7 @@ export default class Game { action(o, opt) { const defaultOpt = { - callback: function () { }, + callback: function () {}, }; opt = $j.extend(defaultOpt, opt); @@ -1536,11 +1532,6 @@ export default class Game { break; case 'ability': { const args = $j.makeArray(o.args[1]); - const ability = this.activeCreature.abilities[o.id]; - // If Abolished used Bonfire Spring, reset the range - if (ability.title === 'Bonfire Spring') { - this.activeCreature.accumulatedTeleportRange = 0; - } if (o.target.type == 'hex') { args.unshift(this.grid.hexes[o.target.y][o.target.x]);