From 5f0407b88dc19e0e3e301fcb3484c19a7040fb23 Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:19:04 -0500 Subject: [PATCH 01/13] Update creature.ts --- src/creature.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/creature.ts b/src/creature.ts index 2cec8a6a0..6da46940b 100644 --- a/src/creature.ts +++ b/src/creature.ts @@ -160,6 +160,7 @@ export class Creature { oldEnergy: number; remainingMove: number; abilities: Ability[]; + accumulatedTeleportRange: number = 0; creatureSprite: CreatureSprite; From b081f1ac90455bb4131a2b9ad31af7be3b70232c Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:20:40 -0500 Subject: [PATCH 02/13] Update game.ts --- src/game.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/game.ts b/src/game.ts index 500947044..8a4ac86ac 100644 --- a/src/game.ts +++ b/src/game.ts @@ -1260,6 +1260,9 @@ export default class Game { onStartPhase(/* creature, callback */) { const creature = arguments[0], totalTraps = this.traps.length; + if (creature.abilities.some(ability => ability.name === 'Bonfire Spring')) { + creature.accumulatedTeleportRange += 1; + } let trap: Trap; From 3be4a4b95b8dc197840f5188a23691a83274dea7 Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:21:46 -0500 Subject: [PATCH 03/13] Update Abolished.js --- src/abilities/Abolished.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/abilities/Abolished.js b/src/abilities/Abolished.js index 9366b71b5..dec746e15 100644 --- a/src/abilities/Abolished.js +++ b/src/abilities/Abolished.js @@ -238,9 +238,8 @@ export default (G) => { const ability = this; ability.end(); - if (this.isUpgraded()) { - this.range += 1; - } + const totalRange = this.range + this.creature.accumulatedTeleportRange; + this.creature.accumulatedTeleportRange = 0; const targets = ability.getTargets(ability.creature.adjacentHexes(1)); From 738a21a34508d3456807d0d3bed689ff80ecaf60 Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:23:04 -0500 Subject: [PATCH 04/13] Update game.ts --- src/game.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/game.ts b/src/game.ts index 8a4ac86ac..de2f8db0e 100644 --- a/src/game.ts +++ b/src/game.ts @@ -1535,6 +1535,11 @@ export default class Game { break; case 'ability': { const args = $j.makeArray(o.args[1]); + const ability = this.activeCreature.abilities[o.id]; + + 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]); From a2447cd25ef529b8e845b608101de686b10f9d06 Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:26:41 -0500 Subject: [PATCH 05/13] Update Abolished.js --- src/abilities/Abolished.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abilities/Abolished.js b/src/abilities/Abolished.js index dec746e15..060272f73 100644 --- a/src/abilities/Abolished.js +++ b/src/abilities/Abolished.js @@ -210,7 +210,7 @@ export default (G) => { { // Type : Can be "onQuery", "onStartPhase", "onDamage" trigger: 'onQuery', - range: 6, + range: 3, require() { return this.testRequirements(); }, From 489c46e355312f3f1281d05055ac112f54e4fd02 Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Mon, 9 Dec 2024 01:53:40 -0500 Subject: [PATCH 06/13] Update Abolished.js --- src/abilities/Abolished.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/abilities/Abolished.js b/src/abilities/Abolished.js index 060272f73..ca7dde35e 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 @@ -214,15 +215,20 @@ export default (G) => { 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, this.range, crea.size, crea.id), + range: G.grid.getFlyingRange(crea.x, crea.y, totalRange, crea.size, crea.id), callback: function (hex, args) { if (hex.x == args.creature.x && hex.y == args.creature.y) { // Prevent null movement @@ -237,10 +243,7 @@ export default (G) => { activate(hex) { const ability = this; ability.end(); - - const totalRange = this.range + this.creature.accumulatedTeleportRange; this.creature.accumulatedTeleportRange = 0; - const targets = ability.getTargets(ability.creature.adjacentHexes(1)); targets.forEach(function (item) { @@ -307,6 +310,8 @@ export default (G) => { G.activeCreature.queryMove(); }, }); + + this.is_used = true; }, }, // Fourth Ability: Greater Pyre From 6fab35ff2172e96c5578e32287996c3c0cdf9d0b Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:53:54 -0500 Subject: [PATCH 07/13] Update game.ts --- src/game.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/game.ts b/src/game.ts index de2f8db0e..8a87ad955 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,10 +1260,9 @@ export default class Game { onStartPhase(/* creature, callback */) { const creature = arguments[0], totalTraps = this.traps.length; - if (creature.abilities.some(ability => ability.name === 'Bonfire Spring')) { - creature.accumulatedTeleportRange += 1; - } - + if (creature.abilities.some(ability => ability.title === 'Bonfire Spring')) { + creature.accumulatedTeleportRange += 1; + } let trap: Trap; for (let i = 0; i < totalTraps; i++) { @@ -1506,7 +1505,7 @@ export default class Game { action(o, opt) { const defaultOpt = { - callback: function () {}, + callback: function () { }, }; opt = $j.extend(defaultOpt, opt); @@ -1536,10 +1535,9 @@ export default class Game { case 'ability': { const args = $j.makeArray(o.args[1]); const ability = this.activeCreature.abilities[o.id]; - if (ability.title === 'Bonfire Spring') { - this.activeCreature.accumulatedTeleportRange = 0; - } + this.activeCreature.accumulatedTeleportRange = 0; + } if (o.target.type == 'hex') { args.unshift(this.grid.hexes[o.target.y][o.target.x]); From cc81ae2ac40b20af008c792c1e7b67dd5665fd63 Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:57:26 -0500 Subject: [PATCH 08/13] Update creature.ts --- src/creature.ts | 90 ++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/creature.ts b/src/creature.ts index 6da46940b..8a80f0309 100644 --- a/src/creature.ts +++ b/src/creature.ts @@ -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); @@ -730,7 +730,7 @@ export class Creature { fnOnConfirm: function () { game.UI.btnSkipTurn.click(); }, - fnOnCancel: function () {}, + fnOnCancel: function () { }, confirmText: 'Skip turn', }); } else { @@ -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 = From fc092145843046f108205bab0c3a258741243dc6 Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:03:49 -0500 Subject: [PATCH 09/13] Update Abolished.js --- src/abilities/Abolished.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/abilities/Abolished.js b/src/abilities/Abolished.js index ca7dde35e..821f10446 100644 --- a/src/abilities/Abolished.js +++ b/src/abilities/Abolished.js @@ -310,8 +310,6 @@ export default (G) => { G.activeCreature.queryMove(); }, }); - - this.is_used = true; }, }, // Fourth Ability: Greater Pyre From 530d4b16ef17af1b3b6ce410d253335b132fbc8d Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:24:28 -0500 Subject: [PATCH 10/13] Added a third skill use check for Abolished At the end of the turn check if Abolished has used his third skill, if not and the skill has been upgraded he gains extra movement distance. --- src/game.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/game.ts b/src/game.ts index 8a87ad955..39e74848e 100644 --- a/src/game.ts +++ b/src/game.ts @@ -1260,9 +1260,7 @@ export default class Game { onStartPhase(/* creature, callback */) { const creature = arguments[0], totalTraps = this.traps.length; - if (creature.abilities.some(ability => ability.title === 'Bonfire Spring')) { - creature.accumulatedTeleportRange += 1; - } + let trap: Trap; for (let i = 0; i < totalTraps; i++) { @@ -1295,6 +1293,10 @@ 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); From 5a8af80ead6d04620272073dc6a22b9cd2b2276e Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:02:26 -0500 Subject: [PATCH 11/13] Added some comments --- src/game.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game.ts b/src/game.ts index 39e74848e..6d2afab90 100644 --- a/src/game.ts +++ b/src/game.ts @@ -1537,6 +1537,7 @@ export default class Game { 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; } From 1a271befdd87cf48fc34ca1f8d1372330e7b187c Mon Sep 17 00:00:00 2001 From: "Hongrui \"Jim\" Yu" <113254490+Luffy117@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:03:35 -0500 Subject: [PATCH 12/13] Added a comment --- src/creature.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/creature.ts b/src/creature.ts index 8a80f0309..8244d10ed 100644 --- a/src/creature.ts +++ b/src/creature.ts @@ -160,7 +160,7 @@ export class Creature { oldEnergy: number; remainingMove: number; abilities: Ability[]; - accumulatedTeleportRange: number = 0; + accumulatedTeleportRange: number = 0; // Only for Abolished's third ability for now creatureSprite: CreatureSprite; From 7e876d83ab0e882183e3c0ea68f21e968f186214 Mon Sep 17 00:00:00 2001 From: Dread Knight Date: Tue, 10 Dec 2024 03:06:59 +0200 Subject: [PATCH 13/13] comment tweak --- src/creature.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/creature.ts b/src/creature.ts index 8244d10ed..70f96b497 100644 --- a/src/creature.ts +++ b/src/creature.ts @@ -160,7 +160,7 @@ export class Creature { oldEnergy: number; remainingMove: number; abilities: Ability[]; - accumulatedTeleportRange: number = 0; // Only for Abolished's third ability for now + accumulatedTeleportRange: number = 0; // Used for Abolished's third ability creatureSprite: CreatureSprite;