From dd6f28f986e59e64ee6403c247201b01e39b11c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zajac?= Date: Wed, 18 Oct 2023 10:14:36 +0200 Subject: [PATCH] Referencing player.flipped on all creatures --- src/abilities/Abolished.js | 2 +- src/abilities/Asher.js | 2 +- src/abilities/Bounty-Hunter.ts | 4 ++-- src/abilities/Chimera.js | 9 ++++---- src/abilities/Cyber-Wolf.js | 4 ++-- src/abilities/Dark-Priest.js | 6 ++--- src/abilities/Golden-Wyrm.js | 6 ++--- src/abilities/Gumble.js | 4 ++-- src/abilities/Headless.js | 8 +++---- src/abilities/Impaler.js | 8 +++---- src/abilities/Infernal.js | 10 ++++----- src/abilities/Knightmare.js | 8 +++---- src/abilities/Nutcase.js | 7 +++--- src/abilities/Scavenger.js | 6 ++--- src/abilities/Snow-Bunny.ts | 6 ++--- src/abilities/Stomper.js | 40 +++++++++++++++++----------------- src/abilities/Swine-Thug.ts | 4 ++-- src/abilities/Uncle-Fungus.js | 6 ++--- src/abilities/Vehemoth.js | 8 +++---- src/creature.ts | 19 +++++++--------- src/player.ts | 1 - 21 files changed, 80 insertions(+), 88 deletions(-) diff --git a/src/abilities/Abolished.js b/src/abilities/Abolished.js index c907d07bf..9366b71b5 100644 --- a/src/abilities/Abolished.js +++ b/src/abilities/Abolished.js @@ -117,7 +117,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: abolished.flipped, + flipped: abolished.player.flipped, team: this._targetTeam, id: this.creature.id, requireCreature: true, diff --git a/src/abilities/Asher.js b/src/abilities/Asher.js index f79f49cf6..db3a05a60 100644 --- a/src/abilities/Asher.js +++ b/src/abilities/Asher.js @@ -87,7 +87,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: crea.flipped, + flipped: crea.player.flipped, team: this._targetTeam, id: this.creature.id, requireCreature: true, diff --git a/src/abilities/Bounty-Hunter.ts b/src/abilities/Bounty-Hunter.ts index de5071dbc..9db1130bf 100644 --- a/src/abilities/Bounty-Hunter.ts +++ b/src/abilities/Bounty-Hunter.ts @@ -136,7 +136,7 @@ export default (G: Game) => { }, team: this._targetTeam, id: crea.id, - flipped: crea.flipped, + flipped: crea.player.flipped, hexes: crea.adjacentHexes(1), }); }, @@ -266,7 +266,7 @@ export default (G: Game) => { team: this._targetTeam, requireCreature: 1, id: swine.id, - flipped: swine.flipped, + flipped: swine.player.flipped, choices: choices, }); }, diff --git a/src/abilities/Chimera.js b/src/abilities/Chimera.js index ac56106a4..979aee0ba 100644 --- a/src/abilities/Chimera.js +++ b/src/abilities/Chimera.js @@ -77,10 +77,9 @@ export default (G) => { }, team: this._targetTeam, id: chimera.id, - flipped: chimera.flipped, + flipped: chimera.player.flipped, hexes: G.grid.getHexMap(chimera.x - 3, chimera.y - 2, 0, false, matrices.frontnback3hex), }); - console.log('Chimera.Flipped:', chimera.flipped); }, // activate() : @@ -137,7 +136,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: chimera.flipped, + flipped: chimera.player.flipped, team: this._targetTeam, id: chimera.id, requireCreature: true, @@ -224,7 +223,7 @@ export default (G) => { _getDirections: function () { return this.testDirections({ - flipped: this.creature.flipped, + flipped: this.creature.player.flipped, team: this._targetTeam, id: this.creature.id, requireCreature: true, @@ -263,7 +262,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: chimera.flipped, + flipped: chimera.player.flipped, team: this._targetTeam, id: chimera.id, directions: this._getDirections(), diff --git a/src/abilities/Cyber-Wolf.js b/src/abilities/Cyber-Wolf.js index 664252f00..d6eb50eb0 100755 --- a/src/abilities/Cyber-Wolf.js +++ b/src/abilities/Cyber-Wolf.js @@ -92,7 +92,7 @@ export default (G) => { }, // fnOnConfirm team: this._targetTeam, id: crea.id, - flipped: crea.flipped, + flipped: crea.player.flipped, hexes: crea.getHexMap(matrices.frontnback2hex), }); }, @@ -342,7 +342,7 @@ export default (G) => { }, // fnOnConfirm team: Team.Enemy, id: crea.id, - flipped: crea.flipped, + flipped: crea.player.flipped, hexes: hexes, }); }, diff --git a/src/abilities/Dark-Priest.js b/src/abilities/Dark-Priest.js index 021249582..07b8ef232 100755 --- a/src/abilities/Dark-Priest.js +++ b/src/abilities/Dark-Priest.js @@ -96,7 +96,7 @@ export default (G) => { }, team: this._targetTeam, id: dpriest.id, - flipped: dpriest.flipped, + flipped: dpriest.player.flipped, hexes: dpriest.adjacentHexes(this.isUpgraded() ? 4 : 1), }); }, @@ -181,7 +181,7 @@ export default (G) => { }, team: this._targetTeam, id: dpriest.id, - flipped: dpriest.flipped, + flipped: dpriest.player.flipped, hexes: dpriest.adjacentHexes(2), }); }, @@ -314,7 +314,7 @@ export default (G) => { cost: crea.size - 0 + (crea.level - 0), }, // OptionalArgs size: crea.size, - flipped: dpriest.flipped, + flipped: dpriest.player.flipped, hexes: spawnRange, }); }, diff --git a/src/abilities/Golden-Wyrm.js b/src/abilities/Golden-Wyrm.js index d9152ff4f..58f3adb14 100755 --- a/src/abilities/Golden-Wyrm.js +++ b/src/abilities/Golden-Wyrm.js @@ -117,7 +117,7 @@ export default (G) => { }, team: this._targetTeam, id: wyrm.id, - flipped: wyrm.flipped, + flipped: wyrm.player.flipped, hexes: this._getHexes(), }); }, @@ -224,7 +224,7 @@ export default (G) => { ability.animation(...arguments); }, size: wyrm.size, - flipped: wyrm.flipped, + flipped: wyrm.player.flipped, id: wyrm.id, hexes: range, }); @@ -348,7 +348,7 @@ export default (G) => { optTest: this._confirmTarget, team: this._targetTeam, id: wyrm.id, - flipped: wyrm.flipped, + flipped: wyrm.player.flipped, hexes: this._getHexes(), }); }, diff --git a/src/abilities/Gumble.js b/src/abilities/Gumble.js index a890db1b0..ea24cffeb 100644 --- a/src/abilities/Gumble.js +++ b/src/abilities/Gumble.js @@ -182,7 +182,7 @@ export default (G) => { ability.animation(...arguments); }, size: creature.size, - flipped: creature.flipped, + flipped: creature.player.flipped, id: creature.id, hexes: hexes, ownCreatureHexShade: true, @@ -286,7 +286,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: crea.flipped, + flipped: crea.player.flipped, team: this._targetTeam, id: this.creature.id, requireCreature: true, diff --git a/src/abilities/Headless.js b/src/abilities/Headless.js index 5c93ce821..c81d1e8a1 100755 --- a/src/abilities/Headless.js +++ b/src/abilities/Headless.js @@ -139,7 +139,7 @@ export default (G) => { }, team: this._targetTeam, id: crea.id, - flipped: crea.flipped, + flipped: crea.player.flipped, hexes: crea.getHexMap(matrices.frontnback2hex), }); }, @@ -227,7 +227,7 @@ export default (G) => { !this.testDirection({ team: this._targetTeam, sourceCreature: headless, - flipped: headless.flipped, + flipped: headless.player.flipped, directions: this._directions, distance: this._getMaxDistance(), minDistance: this.range.minimum, @@ -251,7 +251,7 @@ export default (G) => { team: this._targetTeam, id: headless.id, sourceCreature: headless, - flipped: headless.flipped, + flipped: headless.player.flipped, x: headless.x, y: headless.y, directions: this._directions, @@ -377,7 +377,7 @@ export default (G) => { team: Team.Both, requireCreature: 0, id: crea.id, - flipped: crea.flipped, + flipped: crea.player.flipped, choices: [crea.getHexMap(hexes), crea.getHexMap(hexes, true)], }); }, diff --git a/src/abilities/Impaler.js b/src/abilities/Impaler.js index f48356c01..dcfc01973 100644 --- a/src/abilities/Impaler.js +++ b/src/abilities/Impaler.js @@ -81,15 +81,13 @@ export default (G) => { query: function () { const ability = this; const creature = this.creature; - console.log('Creature.Flipped:', creature.flipped); - console.log('this.Creature.Flipped:', this.creature.flipped); G.grid.queryCreature({ fnOnConfirm: function () { ability.animation(...arguments); }, team: this._targetTeam, id: creature.id, - flipped: creature.flipped, + flipped: creature.player.flipped, hexes: this._getHexes(), }); }, @@ -169,7 +167,7 @@ export default (G) => { }, team: this._targetTeam, id: creature.id, - flipped: creature.flipped, + flipped: creature.player.flipped, hexes: this._getHexes(), }); }, @@ -289,7 +287,7 @@ export default (G) => { }, team: this._targetTeam, id: this.creature.id, - flipped: this.creature.flipped, + flipped: this.creature.player.flipped, hexes: this._getHexes(), }); }, diff --git a/src/abilities/Infernal.js b/src/abilities/Infernal.js index d4162e0b0..b72bee7d6 100755 --- a/src/abilities/Infernal.js +++ b/src/abilities/Infernal.js @@ -25,7 +25,7 @@ export default (G) => { activate: function () { // Leave two traps behind this._addTrap(this.creature.hexagons[1]); - this._addTrap(this.creature.hexagons[this.creature.flipped ? 0 : 2]); + this._addTrap(this.creature.hexagons[this.creature.player.flipped ? 0 : 2]); // SFX const music = G.Phaser.add.audio('MagmaSpawn0'); @@ -112,7 +112,7 @@ export default (G) => { }, team: this._targetTeam, id: magmaSpawn.id, - flipped: magmaSpawn.flipped, + flipped: magmaSpawn.player.flipped, hexes: this.creature.getHexMap(matrices.frontnback3hex), }); }, @@ -202,7 +202,7 @@ export default (G) => { team: Team.Both, requireCreature: 0, id: magmaSpawn.id, - flipped: magmaSpawn.flipped, + flipped: magmaSpawn.player.flipped, choices: [magmaSpawn.getHexMap(this.map), magmaSpawn.getHexMap(this.map, true)], }); }, @@ -259,7 +259,7 @@ export default (G) => { } const magmaSpawn = this.creature; - const x = magmaSpawn.flipped ? magmaSpawn.x - magmaSpawn.size + 1 : magmaSpawn.x; + const x = magmaSpawn.player.flipped ? magmaSpawn.x - magmaSpawn.size + 1 : magmaSpawn.x; if ( !this.testDirection({ @@ -278,7 +278,7 @@ export default (G) => { const ability = this; const magmaSpawn = this.creature; - const x = magmaSpawn.flipped ? magmaSpawn.x - magmaSpawn.size + 1 : magmaSpawn.x; + const x = magmaSpawn.player.flipped ? magmaSpawn.x - magmaSpawn.size + 1 : magmaSpawn.x; G.grid.queryDirection({ fnOnConfirm: function () { diff --git a/src/abilities/Knightmare.js b/src/abilities/Knightmare.js index 094b80ef9..bee2eda49 100644 --- a/src/abilities/Knightmare.js +++ b/src/abilities/Knightmare.js @@ -94,7 +94,7 @@ export default (G) => { }, team: this._targetTeam, id: this.creature.id, - flipped: this.creature.flipped, + flipped: this.creature.player.flipped, hexes: this.creature.getHexMap(matrices.frontnback2hex), }); }, @@ -170,7 +170,7 @@ export default (G) => { }, team: this._targetTeam, id: this.creature.id, - flipped: this.creature.flipped, + flipped: this.creature.player.flipped, hexes: this.creature.getHexMap(matrices.frontnback2hex), }); }, @@ -239,7 +239,7 @@ export default (G) => { } const crea = this.creature; - const x = crea.flipped ? crea.x - crea.size + 1 : crea.x; + const x = crea.player.flipped ? crea.x - crea.size + 1 : crea.x; if ( !this.testDirection({ @@ -260,7 +260,7 @@ export default (G) => { const ability = this; const crea = this.creature; - const x = crea.flipped ? crea.x - crea.size + 1 : crea.x; + const x = crea.player.flipped ? crea.x - crea.size + 1 : crea.x; G.grid.queryDirection({ fnOnConfirm: function () { diff --git a/src/abilities/Nutcase.js b/src/abilities/Nutcase.js index 06a844379..2a9c1cdf6 100644 --- a/src/abilities/Nutcase.js +++ b/src/abilities/Nutcase.js @@ -151,10 +151,9 @@ export default (G) => { }, team: this._targetTeam, id: this.creature.id, - flipped: this.creature.flipped, + flipped: this.creature.player.flipped, hexes: this.creature.getHexMap(matrices.frontnback2hex), }); - console.log('Nutcase.Flipped:', this.creature.flipped); } else { // If upgraded, show choice of front and back hex groups const choices = [ @@ -388,7 +387,7 @@ export default (G) => { G.grid.cleanReachable(); const isChargingBackwards = - (nutcase.flipped && args.direction === Direction.Right) || + (nutcase.player.flipped && args.direction === Direction.Right) || args.direction === Direction.Left; nutcase.moveTo(destination, { @@ -581,7 +580,7 @@ export default (G) => { }, team: this._targetTeam, id: this.creature.id, - flipped: this.creature.flipped, + flipped: this.creature.player.flipped, hexes: this.creature.getHexMap(matrices.inlinefrontnback2hex), optTest: function (creature) { // Size restriction of 2 if unupgraded diff --git a/src/abilities/Scavenger.js b/src/abilities/Scavenger.js index 84f910fe9..d33d3cc55 100755 --- a/src/abilities/Scavenger.js +++ b/src/abilities/Scavenger.js @@ -72,7 +72,7 @@ export default (G) => { }, team: this._targetTeam, id: this.creature.id, - flipped: this.creature.flipped, + flipped: this.creature.player.flipped, hexes: this.creature.getHexMap(matrices.frontnback2hex), }); }, @@ -229,7 +229,7 @@ export default (G) => { team: this._targetTeam, id: [crea.id, trg.id], size: size, - flipped: crea.flipped, + flipped: crea.player.player.flipped, hexes: G.grid .getFlyingRange(x, crea.y, distance, size, [crea.id, trg.id]) .filter(function (item) { @@ -336,7 +336,7 @@ export default (G) => { }, team: this._targetTeam, id: this.creature.id, - flipped: this.creature.flipped, + flipped: this.creature.player.flipped, hexes: this.creature.getHexMap(matrices.frontnback2hex), }); }, diff --git a/src/abilities/Snow-Bunny.ts b/src/abilities/Snow-Bunny.ts index 50554da34..c3cc4d25f 100755 --- a/src/abilities/Snow-Bunny.ts +++ b/src/abilities/Snow-Bunny.ts @@ -255,7 +255,7 @@ export default (G: Game) => { }, team: this._targetTeam, id: snowBunny.id, - flipped: snowBunny.flipped, + flipped: snowBunny.player.flipped, hexes: snowBunny.adjacentHexes(1), }); }, @@ -327,7 +327,7 @@ export default (G: Game) => { // eslint-disable-next-line ability.animation(...arguments); }, - flipped: snowBunny.flipped, + flipped: snowBunny.player.flipped, team: this._targetTeam, id: snowBunny.id, requireCreature: true, @@ -447,7 +447,7 @@ export default (G: Game) => { // eslint-disable-next-line ability.animation(...arguments); }, - flipped: snowBunny.flipped, + flipped: snowBunny.player.flipped, team: this._targetTeam, id: snowBunny.id, requireCreature: true, diff --git a/src/abilities/Stomper.js b/src/abilities/Stomper.js index 6832bafed..85aa15c81 100644 --- a/src/abilities/Stomper.js +++ b/src/abilities/Stomper.js @@ -107,7 +107,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: stomper.flipped, + flipped: stomper.player.flipped, team: this._targetTeam, id: stomper.id, requireCreature: true, @@ -134,7 +134,7 @@ export default (G) => { ability.animation(targetHexList, arguments[1], arguments[2]); } }, - flipped: stomper.flipped, + flipped: stomper.player.flipped, team: this._targetTeam, id: stomper.id, requireCreature: true, @@ -212,7 +212,7 @@ export default (G) => { stomper.x, stomper.y, 0, - stomper.flipped, + stomper.player.flipped, matrices.straitrow, ); } else if (!direction[1]) { @@ -220,7 +220,7 @@ export default (G) => { stomper.x, stomper.y, 0, - !stomper.flipped, + !stomper.player.flipped, matrices.straitrow, ); } else { @@ -228,14 +228,14 @@ export default (G) => { stomper.x, stomper.y, 0, - stomper.flipped, + stomper.player.flipped, matrices.straitrow, ); const backward = G.grid.getHexMap( stomper.x, stomper.y, 0, - !stomper.flipped, + !stomper.player.flipped, matrices.straitrow, ); hexes = forward.concat(backward); @@ -249,24 +249,24 @@ export default (G) => { const ability = this; const stomper = this.creature; - const fw = stomper.flipped ? stomper.x - 2 : stomper.x + 1; - const bw = stomper.flipped ? stomper.x + 1 : stomper.x - 2; + const fw = stomper.player.flipped ? stomper.x - 2 : stomper.x + 1; + const bw = stomper.player.flipped ? stomper.x + 1 : stomper.x - 2; const targets = []; if (!direction[4]) { targets.push( - ...ability._getCreature(G.grid.getHexLine(fw, stomper.y, 1, stomper.flipped)), + ...ability._getCreature(G.grid.getHexLine(fw, stomper.y, 1, stomper.player.flipped)), ); } else if (!direction[1]) { targets.push( - ...ability._getCreature(G.grid.getHexLine(bw, stomper.y, 4, stomper.flipped)), + ...ability._getCreature(G.grid.getHexLine(bw, stomper.y, 4, stomper.player.flipped)), ); } else { targets.push( - ...ability._getCreature(G.grid.getHexLine(fw, stomper.y, 1, stomper.flipped)), + ...ability._getCreature(G.grid.getHexLine(fw, stomper.y, 1, stomper.player.flipped)), ); targets.push( - ...ability._getCreature(G.grid.getHexLine(bw, stomper.y, 4, stomper.flipped)), + ...ability._getCreature(G.grid.getHexLine(bw, stomper.y, 4, stomper.player.flipped)), ); } @@ -304,18 +304,18 @@ export default (G) => { ability._directions = [0, 0, 0, 0, 0, 0]; - const fw = stomper.flipped ? stomper.x - 2 : stomper.x + 1; - const bw = stomper.flipped ? stomper.x + 1 : stomper.x - 2; + const fw = stomper.player.flipped ? stomper.x - 2 : stomper.x + 1; + const bw = stomper.player.flipped ? stomper.x + 1 : stomper.x - 2; if (!direction[4]) { - hexes = G.grid.getHexLine(fw, stomper.y, 1, stomper.flipped); + hexes = G.grid.getHexLine(fw, stomper.y, 1, stomper.player.flipped); if (this._getHole(hexes)) ability._directions = direction; } else if (!direction[1]) { - hexes = G.grid.getHexLine(bw, stomper.y, 4, stomper.flipped); + hexes = G.grid.getHexLine(bw, stomper.y, 4, stomper.player.flipped); if (this._getHole(hexes)) ability._directions = direction; } else { - const forward = G.grid.getHexLine(fw, stomper.y, 1, stomper.flipped); - const backward = G.grid.getHexLine(bw, stomper.y, 4, stomper.flipped); + const forward = G.grid.getHexLine(fw, stomper.y, 1, stomper.player.flipped); + const backward = G.grid.getHexLine(bw, stomper.y, 4, stomper.player.flipped); if (this._getHole(forward)) ability._directions[1] = 1; if (this._getHole(backward)) ability._directions[4] = 1; } @@ -377,7 +377,7 @@ export default (G) => { team: Team.Both, requireCreature: 0, id: stomper.id, - flipped: stomper.flipped, + flipped: stomper.player.flipped, choices: [targets, targets2], // Target the front or back row hexesDashed: dashed, }); @@ -490,7 +490,7 @@ export default (G) => { team: Team.Both, requireCreature: 0, id: stomper.id, - flipped: stomper.flipped, + flipped: stomper.player.flipped, choices: [stomper.getHexMap(this.map), stomper.getHexMap(this.map, true)], }); }, diff --git a/src/abilities/Swine-Thug.ts b/src/abilities/Swine-Thug.ts index 222a70f89..1918f0f73 100644 --- a/src/abilities/Swine-Thug.ts +++ b/src/abilities/Swine-Thug.ts @@ -141,7 +141,7 @@ export default (G: Game) => { // eslint-disable-next-line ability.animation(...arguments); }, - flipped: swine.flipped, + flipped: swine.player.flipped, team: this._targetTeam, id: swine.id, requireCreature: true, @@ -318,7 +318,7 @@ export default (G: Game) => { team: this._targetTeam, requireCreature: 1, id: swine.id, - flipped: swine.flipped, + flipped: swine.player.flipped, choices: choices, }); }, diff --git a/src/abilities/Uncle-Fungus.js b/src/abilities/Uncle-Fungus.js index 2249a3af1..11e09ecc1 100755 --- a/src/abilities/Uncle-Fungus.js +++ b/src/abilities/Uncle-Fungus.js @@ -113,7 +113,7 @@ export default (G) => { }, team: this._targetTeam, id: uncle.id, - flipped: uncle.flipped, + flipped: uncle.player.flipped, hexes: uncle.getHexMap(matrices.frontnback2hex), }); }, @@ -225,7 +225,7 @@ export default (G) => { ability.animation(...arguments); }, size: uncle.size, - flipped: uncle.flipped, + flipped: uncle.player.flipped, id: uncle.id, hexes: hexes, hexesDashed: [], @@ -369,7 +369,7 @@ export default (G) => { }, team: this._targetTeam, id: uncle.id, - flipped: uncle.flipped, + flipped: uncle.player.flipped, hexes: G.grid.getHexMap(uncle.x - 2, uncle.y - 2, 0, false, matrices.frontnback2hex), }); }, diff --git a/src/abilities/Vehemoth.js b/src/abilities/Vehemoth.js index b3627ba58..f4a950f9d 100644 --- a/src/abilities/Vehemoth.js +++ b/src/abilities/Vehemoth.js @@ -122,7 +122,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: vehemoth.flipped, + flipped: vehemoth.player.flipped, id: vehemoth.id, team: Team.Enemy, requireCreature: true, @@ -132,7 +132,7 @@ export default (G) => { if (this.isUpgraded()) { const directionObject = G.grid.getDirectionChoices({ - flipped: vehemoth.flipped, + flipped: vehemoth.player.flipped, team: this._targetTeam, requireCreature: true, stopOnCreature: true, @@ -323,7 +323,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: vehemoth.flipped, + flipped: vehemoth.player.flipped, team: this._targetTeam, id: vehemoth.id, requireCreature: true, @@ -461,7 +461,7 @@ export default (G) => { }, team: this._targetTeam, id: vehemoth.id, - flipped: vehemoth.flipped, + flipped: vehemoth.player.flipped, hexes: this._getHexes(), }); }, diff --git a/src/creature.ts b/src/creature.ts index fc65b501b..faf297460 100644 --- a/src/creature.ts +++ b/src/creature.ts @@ -120,7 +120,6 @@ export class Creature { x: number; y: number; pos: Point; - flipped: boolean; size: UnitSize; type: CreatureType; level: Level; @@ -176,7 +175,6 @@ export class Creature { y: number; team: PlayerID; temp: boolean; - flipped: boolean; // These are properties that might not exists on all creatures type?: CreatureType; drop?: DropDefinition; @@ -224,7 +222,6 @@ export class Creature { this.dropCollection = []; this.protectedFromFatigue = this.isDarkPriest() ? true : false; this.turnsActive = 0; - this.flipped = this.player.flipped; // Statistics this.baseStats = { @@ -725,7 +722,7 @@ export class Creature { args: o.args, }, // Optional args size: this.size, - flipped: this.flipped, + flipped: this.player.flipped, id: this.id, hexes: o.range, @@ -800,7 +797,7 @@ export class Creature { attackFix?: boolean, ) { if (!facefrom) { - facefrom = this.flipped ? this.hexagons[this.size - 1] : this.hexagons[0]; + facefrom = this.player.flipped ? this.hexagons[this.size - 1] : this.hexagons[0]; } if ( @@ -829,7 +826,7 @@ export class Creature { if (attackFix && this.size > 1) { //only works on 2hex creature targeting the adjacent row - const flipOffset = this.flipped ? 1 : 0; + const flipOffset = this.player.flipped ? 1 : 0; if (facefrom.y % 2 === 0) { if (faceto.x - flipOffset == facefrom.x) { this.facePlayerDefault(); @@ -851,7 +848,7 @@ export class Creature { * Make creature face the default direction of its player */ facePlayerDefault() { - this.creatureSprite.setDir(this.flipped ? -1 : 1); + this.creatureSprite.setDir(this.player.flipped ? -1 : 1); } /** @@ -1467,11 +1464,11 @@ export class Creature { game.onCreatureDeath(this); this.killer = killerCreature.player; - const isDeny = this.killer.flipped == this.flipped; + const isDeny = this.killer.flipped == this.player.flipped; // Drop item if (game.unitDrops == 1 && this.drop) { - const offsetX = this.flipped ? this.x - this.size + 1 : this.x; + const offsetX = this.player.flipped ? this.x - this.size + 1 : this.x; const { name, ...alterations } = this.drop; new Drop(name, alterations, offsetX, this.y, game); } @@ -1570,14 +1567,14 @@ export class Creature { * Shortcut convenience function to grid.getHexMap */ getHexMap(map: AugmentedMatrix, invertFlipped: boolean) { - const x = (this.flipped ? !invertFlipped : invertFlipped) + const x = (this.player.flipped ? !invertFlipped : invertFlipped) ? this.x + 1 - this.size : this.x; return this.game.grid.getHexMap( x, this.y - map.origin[1], 0 - map.origin[0], - this.flipped ? !invertFlipped : invertFlipped, + this.player.flipped ? !invertFlipped : invertFlipped, map, ); } diff --git a/src/player.ts b/src/player.ts index 0b480f190..194b91dbb 100644 --- a/src/player.ts +++ b/src/player.ts @@ -151,7 +151,6 @@ export class Player { const creatureData = $j.extend(baseCreatureData, pos, { team: this.id, temp: false, - flipped: this.flipped, }); if (creatureData.name !== 'Dark Priest') {