Skip to content

Commit

Permalink
fixing linter errors: aliasing this & prefer rest params
Browse files Browse the repository at this point in the history
  • Loading branch information
allmtz committed Mar 6, 2024
1 parent 90feb8f commit af032bc
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/abilities/Uncle-Fungus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,9 @@ export default (G: Game) => {
// query() :
query: function () {
const uncle = this.creature;
const ability = this;

G.grid.queryCreature({
fnOnConfirm: function () {
ability.animation(...arguments);
},
fnOnConfirm: (...args) => this.animation(...args),
team: this._targetTeam,
id: uncle.id,
flipped: uncle.player.flipped,
Expand Down Expand Up @@ -197,7 +194,6 @@ export default (G: Game) => {

// query() :
query: function () {
const ability = this;
const uncle = this.creature;

// Don't jump over creatures if we're not upgraded, or we are in a second
Expand All @@ -220,13 +216,15 @@ export default (G: Game) => {
hex.game.activeCreature.faceHex(hex);
}
},
fnOnConfirm: function () {
if (arguments[0].x == ability.creature.x && arguments[0].y == ability.creature.y) {
fnOnConfirm: (...args) => {
const chosenHex = args[0];

if (chosenHex.x == this.creature.x && chosenHex.y == this.creature.y) {
// Prevent null movement
ability.query();
this.query();
return;
}
ability.animation(...arguments);
this.animation(...args);
},
size: uncle.size,
flipped: uncle.player.flipped,
Expand Down Expand Up @@ -364,13 +362,10 @@ export default (G: Game) => {

// query() :
query: function () {
const ability = this;
const uncle = this.creature;

G.grid.queryCreature({
fnOnConfirm: function () {
ability.animation(...arguments);
},
fnOnConfirm: (...args) => this.animation(...args),
team: this._targetTeam,
id: uncle.id,
flipped: uncle.player.flipped,
Expand Down

0 comments on commit af032bc

Please sign in to comment.