From bcdc35bf363cb84e6afc79f6253cd2132226bb46 Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Sat, 7 Dec 2024 20:41:03 -0500 Subject: [PATCH] Update Abolished.js --- src/abilities/Abolished.js | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/abilities/Abolished.js b/src/abilities/Abolished.js index 9366b71b5..cfbacdb29 100644 --- a/src/abilities/Abolished.js +++ b/src/abilities/Abolished.js @@ -4,6 +4,7 @@ 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 @@ -210,19 +211,37 @@ export default (G) => { { // Type : Can be "onQuery", "onStartPhase", "onDamage" trigger: 'onQuery', - range: 6, + range: 3, + bonus_range: 0, + is_used: false, + + _getbonusrange() { + if (this.isUpgraded()) { + if (this.is_used == false) { + this.bonus_range += 1; + } + else { + this.is_used = false; + this.bonus_range = 0; + } + return this.bonus_range; + } + return 0; + }, require() { return this.testRequirements(); }, + query() { const ability = this; const crea = this.creature; + this.bonus_range = ability._getbonusrange(); // 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, this.range, crea.size, crea.id), + range: G.grid.getFlyingRange(crea.x, crea.y, this.range + this.bonus_range, crea.size, crea.id), callback: function (hex, args) { if (hex.x == args.creature.x && hex.y == args.creature.y) { // Prevent null movement @@ -238,10 +257,6 @@ export default (G) => { const ability = this; ability.end(); - if (this.isUpgraded()) { - this.range += 1; - } - const targets = ability.getTargets(ability.creature.adjacentHexes(1)); targets.forEach(function (item) { @@ -308,6 +323,8 @@ export default (G) => { G.activeCreature.queryMove(); }, }); + + this.is_used = true; }, }, // Fourth Ability: Greater Pyre