From 6c712f889abd080f9091f993e37423389649c67b Mon Sep 17 00:00:00 2001 From: Milos Date: Sat, 26 Oct 2024 11:53:58 +0200 Subject: [PATCH 1/3] fix: fix toggling active abilities when passive ability is clicked --- src/ui/interface.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/ui/interface.js b/src/ui/interface.js index 22a4ffb5e..efb2b4da1 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -758,6 +758,21 @@ export class UI { this.abilitiesButtons[i].triggerClick(); return i; } + + //If creature has no more available abilities to choose from, return -1 + let creatureHaveAtleastOneAvailableAbility = false; + for(let y = i; y < 4; y++){ + if(creature.abilities[y].require()){ + creatureHaveAtleastOneAvailableAbility = true; + break; + } + } + + if(!creatureHaveAtleastOneAvailableAbility){ + game.activeCreature.queryMove(); + this.selectAbility(-1); + return -1; + } } } From ad34bb7f0d5018aa485c29e864b890b62ffce156 Mon Sep 17 00:00:00 2001 From: Milos Date: Sat, 26 Oct 2024 12:03:05 +0200 Subject: [PATCH 2/3] fix: fix toggling active abilities when passive ability is clicked --- src/ui/interface.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/interface.js b/src/ui/interface.js index efb2b4da1..04c9406c2 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -759,7 +759,7 @@ export class UI { return i; } - //If creature has no more available abilities to choose from, return -1 + //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()){ @@ -768,6 +768,7 @@ export class UI { } } + //If creature has no more available abilities to choose from, return -1 if(!creatureHaveAtleastOneAvailableAbility){ game.activeCreature.queryMove(); this.selectAbility(-1); From 3c77af9e8475a571c569f04ecc42bdfb81e22201 Mon Sep 17 00:00:00 2001 From: Dread Knight Date: Sun, 27 Oct 2024 18:06:33 +0200 Subject: [PATCH 3/3] linting --- src/ui/interface.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/interface.js b/src/ui/interface.js index 04c9406c2..d300696ce 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -759,17 +759,17 @@ export class UI { return i; } - //Check if creature has at least one more ability to choose from + // 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()){ + 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){ + // If creature has no more available abilities to choose from, return -1 + if(!creatureHaveAtleastOneAvailableAbility) { game.activeCreature.queryMove(); this.selectAbility(-1); return -1;