Skip to content

Commit

Permalink
Merge pull request #2641 from MilosDj21/fix-toggling-abilities
Browse files Browse the repository at this point in the history
Fix: toggling abilities by clicking passive one, closes #2599
  • Loading branch information
DreadKnight authored Oct 27, 2024
2 parents 391e5f7 + 3c77af9 commit 74b7264
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/ui/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,22 @@ export class UI {
this.abilitiesButtons[i].triggerClick();
return i;
}

// Check if creature has at least one more ability to choose from
let creatureHaveAtleastOneAvailableAbility = false;
for(let y = i; y < 4; y++) {
if(creature.abilities[y].require()) {
creatureHaveAtleastOneAvailableAbility = true;
break;
}
}

// If creature has no more available abilities to choose from, return -1
if(!creatureHaveAtleastOneAvailableAbility) {
game.activeCreature.queryMove();
this.selectAbility(-1);
return -1;
}
}
}

Expand Down

0 comments on commit 74b7264

Please sign in to comment.