Skip to content

Commit

Permalink
Referencing player.flipped on all creatures
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomáš Zajac committed Oct 18, 2023
1 parent 6c7c7b7 commit dd6f28f
Show file tree
Hide file tree
Showing 21 changed files with 80 additions and 88 deletions.
2 changes: 1 addition & 1 deletion src/abilities/Abolished.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/abilities/Asher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/abilities/Bounty-Hunter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
},
Expand Down Expand Up @@ -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,
});
},
Expand Down
9 changes: 4 additions & 5 deletions src/abilities/Chimera.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() :
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions src/abilities/Cyber-Wolf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
},
Expand Down Expand Up @@ -342,7 +342,7 @@ export default (G) => {
}, // fnOnConfirm
team: Team.Enemy,
id: crea.id,
flipped: crea.flipped,
flipped: crea.player.flipped,
hexes: hexes,
});
},
Expand Down
6 changes: 3 additions & 3 deletions src/abilities/Dark-Priest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
},
Expand Down Expand Up @@ -181,7 +181,7 @@ export default (G) => {
},
team: this._targetTeam,
id: dpriest.id,
flipped: dpriest.flipped,
flipped: dpriest.player.flipped,
hexes: dpriest.adjacentHexes(2),
});
},
Expand Down Expand Up @@ -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,
});
},
Expand Down
6 changes: 3 additions & 3 deletions src/abilities/Golden-Wyrm.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default (G) => {
},
team: this._targetTeam,
id: wyrm.id,
flipped: wyrm.flipped,
flipped: wyrm.player.flipped,
hexes: this._getHexes(),
});
},
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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(),
});
},
Expand Down
4 changes: 2 additions & 2 deletions src/abilities/Gumble.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/abilities/Headless.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
},
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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)],
});
},
Expand Down
8 changes: 3 additions & 5 deletions src/abilities/Impaler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
},
Expand Down Expand Up @@ -169,7 +167,7 @@ export default (G) => {
},
team: this._targetTeam,
id: creature.id,
flipped: creature.flipped,
flipped: creature.player.flipped,
hexes: this._getHexes(),
});
},
Expand Down Expand Up @@ -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(),
});
},
Expand Down
10 changes: 5 additions & 5 deletions src/abilities/Infernal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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),
});
},
Expand Down Expand Up @@ -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)],
});
},
Expand Down Expand Up @@ -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({
Expand All @@ -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 () {
Expand Down
8 changes: 4 additions & 4 deletions src/abilities/Knightmare.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
},
Expand Down Expand Up @@ -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),
});
},
Expand Down Expand Up @@ -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({
Expand All @@ -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 () {
Expand Down
7 changes: 3 additions & 4 deletions src/abilities/Nutcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/abilities/Scavenger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
},
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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),
});
},
Expand Down
Loading

0 comments on commit dd6f28f

Please sign in to comment.