diff --git a/package-lock.json b/package-lock.json index b61d8fd8f..3397f6e50 100644 --- a/package-lock.json +++ b/package-lock.json @@ -135,9 +135,9 @@ } }, "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -217,9 +217,9 @@ } }, "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -281,9 +281,9 @@ } }, "node_modules/@babel/helper-define-polyfill-provider/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -1500,9 +1500,9 @@ } }, "node_modules/@babel/plugin-transform-runtime/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -1723,9 +1723,9 @@ } }, "node_modules/@babel/preset-env/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -4075,9 +4075,9 @@ } }, "node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -7369,9 +7369,9 @@ } }, "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -9392,9 +9392,9 @@ } }, "node_modules/less/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "optional": true, "bin": { @@ -9750,9 +9750,9 @@ } }, "node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" diff --git a/src/abilities/Abolished.js b/src/abilities/Abolished.js index 9366b71b5..c907d07bf 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.player.flipped, + flipped: abolished.flipped, team: this._targetTeam, id: this.creature.id, requireCreature: true, diff --git a/src/abilities/Asher.js b/src/abilities/Asher.js index db3a05a60..f79f49cf6 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.player.flipped, + flipped: crea.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 9db1130bf..de5071dbc 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.player.flipped, + flipped: crea.flipped, hexes: crea.adjacentHexes(1), }); }, @@ -266,7 +266,7 @@ export default (G: Game) => { team: this._targetTeam, requireCreature: 1, id: swine.id, - flipped: swine.player.flipped, + flipped: swine.flipped, choices: choices, }); }, diff --git a/src/abilities/Chimera.js b/src/abilities/Chimera.js index b3d27e408..ac56106a4 100644 --- a/src/abilities/Chimera.js +++ b/src/abilities/Chimera.js @@ -80,6 +80,7 @@ export default (G) => { flipped: chimera.flipped, hexes: G.grid.getHexMap(chimera.x - 3, chimera.y - 2, 0, false, matrices.frontnback3hex), }); + console.log('Chimera.Flipped:', chimera.flipped); }, // activate() : @@ -136,7 +137,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: chimera.player.flipped, + flipped: chimera.flipped, team: this._targetTeam, id: chimera.id, requireCreature: true, @@ -223,7 +224,7 @@ export default (G) => { _getDirections: function () { return this.testDirections({ - flipped: this.creature.player.flipped, + flipped: this.creature.flipped, team: this._targetTeam, id: this.creature.id, requireCreature: true, @@ -262,7 +263,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: chimera.player.flipped, + flipped: chimera.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 d6eb50eb0..664252f00 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.player.flipped, + flipped: crea.flipped, hexes: crea.getHexMap(matrices.frontnback2hex), }); }, @@ -342,7 +342,7 @@ export default (G) => { }, // fnOnConfirm team: Team.Enemy, id: crea.id, - flipped: crea.player.flipped, + flipped: crea.flipped, hexes: hexes, }); }, diff --git a/src/abilities/Dark-Priest.js b/src/abilities/Dark-Priest.js index 07b8ef232..021249582 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.player.flipped, + flipped: dpriest.flipped, hexes: dpriest.adjacentHexes(this.isUpgraded() ? 4 : 1), }); }, @@ -181,7 +181,7 @@ export default (G) => { }, team: this._targetTeam, id: dpriest.id, - flipped: dpriest.player.flipped, + flipped: dpriest.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.player.flipped, + flipped: dpriest.flipped, hexes: spawnRange, }); }, diff --git a/src/abilities/Golden-Wyrm.js b/src/abilities/Golden-Wyrm.js index dd41611a2..d9152ff4f 100755 --- a/src/abilities/Golden-Wyrm.js +++ b/src/abilities/Golden-Wyrm.js @@ -224,7 +224,7 @@ export default (G) => { ability.animation(...arguments); }, size: wyrm.size, - flipped: wyrm.player.flipped, + flipped: wyrm.flipped, id: wyrm.id, hexes: range, }); diff --git a/src/abilities/Gumble.js b/src/abilities/Gumble.js index ea24cffeb..a890db1b0 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.player.flipped, + flipped: creature.flipped, id: creature.id, hexes: hexes, ownCreatureHexShade: true, @@ -286,7 +286,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: crea.player.flipped, + flipped: crea.flipped, team: this._targetTeam, id: this.creature.id, requireCreature: true, diff --git a/src/abilities/Headless.js b/src/abilities/Headless.js index 305e84fbf..5c93ce821 100755 --- a/src/abilities/Headless.js +++ b/src/abilities/Headless.js @@ -227,7 +227,7 @@ export default (G) => { !this.testDirection({ team: this._targetTeam, sourceCreature: headless, - flipped: headless.player.flipped, + flipped: headless.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.player.flipped, + flipped: headless.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.player.flipped, + flipped: crea.flipped, choices: [crea.getHexMap(hexes), crea.getHexMap(hexes, true)], }); }, diff --git a/src/abilities/Impaler.js b/src/abilities/Impaler.js index bf04b325f..f48356c01 100644 --- a/src/abilities/Impaler.js +++ b/src/abilities/Impaler.js @@ -81,7 +81,8 @@ 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); diff --git a/src/abilities/Infernal.js b/src/abilities/Infernal.js index e00bf0d0a..d4162e0b0 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.player.flipped ? 0 : 2]); + this._addTrap(this.creature.hexagons[this.creature.flipped ? 0 : 2]); // SFX const music = G.Phaser.add.audio('MagmaSpawn0'); @@ -259,7 +259,7 @@ export default (G) => { } const magmaSpawn = this.creature; - const x = magmaSpawn.player.flipped ? magmaSpawn.x - magmaSpawn.size + 1 : magmaSpawn.x; + const x = magmaSpawn.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.player.flipped ? magmaSpawn.x - magmaSpawn.size + 1 : magmaSpawn.x; + const x = magmaSpawn.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 2243b2dfb..094b80ef9 100644 --- a/src/abilities/Knightmare.js +++ b/src/abilities/Knightmare.js @@ -239,7 +239,7 @@ export default (G) => { } const crea = this.creature; - const x = crea.player.flipped ? crea.x - crea.size + 1 : crea.x; + const x = crea.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.player.flipped ? crea.x - crea.size + 1 : crea.x; + const x = crea.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 fbdc79d36..06a844379 100644 --- a/src/abilities/Nutcase.js +++ b/src/abilities/Nutcase.js @@ -154,6 +154,7 @@ export default (G) => { flipped: this.creature.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 = [ @@ -387,7 +388,7 @@ export default (G) => { G.grid.cleanReachable(); const isChargingBackwards = - (nutcase.player.flipped && args.direction === Direction.Right) || + (nutcase.flipped && args.direction === Direction.Right) || args.direction === Direction.Left; nutcase.moveTo(destination, { @@ -587,6 +588,7 @@ export default (G) => { return ability.isUpgraded() ? true : creature.size <= 2; }, }); + }, // activate() : diff --git a/src/abilities/Scavenger.js b/src/abilities/Scavenger.js index f9b937b59..84f910fe9 100755 --- a/src/abilities/Scavenger.js +++ b/src/abilities/Scavenger.js @@ -229,7 +229,7 @@ export default (G) => { team: this._targetTeam, id: [crea.id, trg.id], size: size, - flipped: crea.player.flipped, + flipped: crea.flipped, hexes: G.grid .getFlyingRange(x, crea.y, distance, size, [crea.id, trg.id]) .filter(function (item) { diff --git a/src/abilities/Snow-Bunny.ts b/src/abilities/Snow-Bunny.ts index c3cc4d25f..50554da34 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.player.flipped, + flipped: snowBunny.flipped, hexes: snowBunny.adjacentHexes(1), }); }, @@ -327,7 +327,7 @@ export default (G: Game) => { // eslint-disable-next-line ability.animation(...arguments); }, - flipped: snowBunny.player.flipped, + flipped: snowBunny.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.player.flipped, + flipped: snowBunny.flipped, team: this._targetTeam, id: snowBunny.id, requireCreature: true, diff --git a/src/abilities/Stomper.js b/src/abilities/Stomper.js index b5de4172e..6832bafed 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.player.flipped, + flipped: stomper.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.player.flipped, + flipped: stomper.flipped, team: this._targetTeam, id: stomper.id, requireCreature: true, @@ -212,7 +212,7 @@ export default (G) => { stomper.x, stomper.y, 0, - stomper.player.flipped, + stomper.flipped, matrices.straitrow, ); } else if (!direction[1]) { @@ -220,7 +220,7 @@ export default (G) => { stomper.x, stomper.y, 0, - !stomper.player.flipped, + !stomper.flipped, matrices.straitrow, ); } else { @@ -228,14 +228,14 @@ export default (G) => { stomper.x, stomper.y, 0, - stomper.player.flipped, + stomper.flipped, matrices.straitrow, ); const backward = G.grid.getHexMap( stomper.x, stomper.y, 0, - !stomper.player.flipped, + !stomper.flipped, matrices.straitrow, ); hexes = forward.concat(backward); @@ -249,24 +249,24 @@ export default (G) => { const ability = this; const stomper = this.creature; - const fw = stomper.player.flipped ? stomper.x - 2 : stomper.x + 1; - const bw = stomper.player.flipped ? stomper.x + 1 : stomper.x - 2; + const fw = stomper.flipped ? stomper.x - 2 : stomper.x + 1; + const bw = stomper.flipped ? stomper.x + 1 : stomper.x - 2; const targets = []; if (!direction[4]) { targets.push( - ...ability._getCreature(G.grid.getHexLine(fw, stomper.y, 1, stomper.player.flipped)), + ...ability._getCreature(G.grid.getHexLine(fw, stomper.y, 1, stomper.flipped)), ); } else if (!direction[1]) { targets.push( - ...ability._getCreature(G.grid.getHexLine(bw, stomper.y, 4, stomper.player.flipped)), + ...ability._getCreature(G.grid.getHexLine(bw, stomper.y, 4, stomper.flipped)), ); } else { targets.push( - ...ability._getCreature(G.grid.getHexLine(fw, stomper.y, 1, stomper.player.flipped)), + ...ability._getCreature(G.grid.getHexLine(fw, stomper.y, 1, stomper.flipped)), ); targets.push( - ...ability._getCreature(G.grid.getHexLine(bw, stomper.y, 4, stomper.player.flipped)), + ...ability._getCreature(G.grid.getHexLine(bw, stomper.y, 4, stomper.flipped)), ); } @@ -304,18 +304,18 @@ export default (G) => { ability._directions = [0, 0, 0, 0, 0, 0]; - const fw = stomper.player.flipped ? stomper.x - 2 : stomper.x + 1; - const bw = stomper.player.flipped ? stomper.x + 1 : stomper.x - 2; + const fw = stomper.flipped ? stomper.x - 2 : stomper.x + 1; + const bw = stomper.flipped ? stomper.x + 1 : stomper.x - 2; if (!direction[4]) { - hexes = G.grid.getHexLine(fw, stomper.y, 1, stomper.player.flipped); + hexes = G.grid.getHexLine(fw, stomper.y, 1, stomper.flipped); if (this._getHole(hexes)) ability._directions = direction; } else if (!direction[1]) { - hexes = G.grid.getHexLine(bw, stomper.y, 4, stomper.player.flipped); + hexes = G.grid.getHexLine(bw, stomper.y, 4, stomper.flipped); if (this._getHole(hexes)) ability._directions = direction; } else { - const forward = G.grid.getHexLine(fw, stomper.y, 1, stomper.player.flipped); - const backward = G.grid.getHexLine(bw, stomper.y, 4, stomper.player.flipped); + const forward = G.grid.getHexLine(fw, stomper.y, 1, stomper.flipped); + const backward = G.grid.getHexLine(bw, stomper.y, 4, stomper.flipped); if (this._getHole(forward)) ability._directions[1] = 1; if (this._getHole(backward)) ability._directions[4] = 1; } diff --git a/src/abilities/Swine-Thug.ts b/src/abilities/Swine-Thug.ts index 1918f0f73..222a70f89 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.player.flipped, + flipped: swine.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.player.flipped, + flipped: swine.flipped, choices: choices, }); }, diff --git a/src/abilities/Uncle-Fungus.js b/src/abilities/Uncle-Fungus.js index 61b03cb0f..2249a3af1 100755 --- a/src/abilities/Uncle-Fungus.js +++ b/src/abilities/Uncle-Fungus.js @@ -225,7 +225,7 @@ export default (G) => { ability.animation(...arguments); }, size: uncle.size, - flipped: uncle.player.flipped, + flipped: uncle.flipped, id: uncle.id, hexes: hexes, hexesDashed: [], diff --git a/src/abilities/Vehemoth.js b/src/abilities/Vehemoth.js index a2b0a8307..b3627ba58 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.player.flipped, + flipped: vehemoth.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.player.flipped, + flipped: vehemoth.flipped, team: this._targetTeam, requireCreature: true, stopOnCreature: true, @@ -323,7 +323,7 @@ export default (G) => { fnOnConfirm: function () { ability.animation(...arguments); }, - flipped: vehemoth.player.flipped, + flipped: vehemoth.flipped, team: this._targetTeam, id: vehemoth.id, requireCreature: true, diff --git a/src/creature.ts b/src/creature.ts index 22d9fa407..fc65b501b 100644 --- a/src/creature.ts +++ b/src/creature.ts @@ -120,6 +120,7 @@ export class Creature { x: number; y: number; pos: Point; + flipped: boolean; size: UnitSize; type: CreatureType; level: Level; @@ -175,6 +176,7 @@ 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; @@ -222,6 +224,7 @@ export class Creature { this.dropCollection = []; this.protectedFromFatigue = this.isDarkPriest() ? true : false; this.turnsActive = 0; + this.flipped = this.player.flipped; // Statistics this.baseStats = { @@ -722,7 +725,8 @@ export class Creature { args: o.args, }, // Optional args size: this.size, - flipped: this.player.flipped, + flipped: this.flipped, + id: this.id, hexes: o.range, ownCreatureHexShade: o.ownCreatureHexShade, @@ -796,7 +800,7 @@ export class Creature { attackFix?: boolean, ) { if (!facefrom) { - facefrom = this.player.flipped ? this.hexagons[this.size - 1] : this.hexagons[0]; + facefrom = this.flipped ? this.hexagons[this.size - 1] : this.hexagons[0]; } if ( @@ -825,7 +829,7 @@ export class Creature { if (attackFix && this.size > 1) { //only works on 2hex creature targeting the adjacent row - const flipOffset = this.player.flipped ? 1 : 0; + const flipOffset = this.flipped ? 1 : 0; if (facefrom.y % 2 === 0) { if (faceto.x - flipOffset == facefrom.x) { this.facePlayerDefault(); @@ -847,7 +851,7 @@ export class Creature { * Make creature face the default direction of its player */ facePlayerDefault() { - this.creatureSprite.setDir(this.player.flipped ? -1 : 1); + this.creatureSprite.setDir(this.flipped ? -1 : 1); } /** @@ -1463,11 +1467,11 @@ export class Creature { game.onCreatureDeath(this); this.killer = killerCreature.player; - const isDeny = this.killer.flipped == this.player.flipped; + const isDeny = this.killer.flipped == this.flipped; // Drop item if (game.unitDrops == 1 && this.drop) { - const offsetX = this.player.flipped ? this.x - this.size + 1 : this.x; + const offsetX = this.flipped ? this.x - this.size + 1 : this.x; const { name, ...alterations } = this.drop; new Drop(name, alterations, offsetX, this.y, game); } @@ -1566,14 +1570,14 @@ export class Creature { * Shortcut convenience function to grid.getHexMap */ getHexMap(map: AugmentedMatrix, invertFlipped: boolean) { - const x = (this.player.flipped ? !invertFlipped : invertFlipped) + const x = (this.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.player.flipped ? !invertFlipped : invertFlipped, + this.flipped ? !invertFlipped : invertFlipped, map, ); } diff --git a/src/player.ts b/src/player.ts index 194b91dbb..0b480f190 100644 --- a/src/player.ts +++ b/src/player.ts @@ -151,6 +151,7 @@ export class Player { const creatureData = $j.extend(baseCreatureData, pos, { team: this.id, temp: false, + flipped: this.flipped, }); if (creatureData.name !== 'Dark Priest') {