Skip to content

Commit

Permalink
Changing the bank setting while values are banked (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eligarf authored Aug 8, 2024
1 parent e4d0ee6 commit a280bf9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v4.6.1
* Update pt-BR.json (thanks Kharmans)
* Handle the case where banking is changed from actor to token while a stealth effect is still active on tokens. In this case, the effect will continue to hold the banked values until it is removed.

# v4.6.0
* dnd5e: Added a check box to the detection modes configuration dialog, selecting which detection modes can be affected by dim light.
* dnd5e: 3.3 compatible
Expand Down
18 changes: 12 additions & 6 deletions scripts/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ export default class Engine {
}
await canvas.scene.updateEmbeddedDocuments("Token", [update]);
}

else {
Stealthy.log('**** TRYING TO SET ACTOR VALUE WITHOUT EFFECT ****');
}
}

async bankRollOnToken(tokenOrActor, skill, value) {
Expand Down Expand Up @@ -518,19 +522,21 @@ export default class Engine {
}

async bankStealth(token, value) {
if (stealthy.stealthToActor) {
await this.updateOrCreateStealthEffect(token.actor, { stealth: value });
} else {
while (!stealthy.stealthToActor) {
if (this.findStealthEffect(actor)) break;
await this.bankRollOnToken(token, 'stealth', value);
return;
}
await this.updateOrCreateStealthEffect(token.actor, { stealth: value });
}

async bankPerception(token, value) {
if (stealthy.perceptionToActor) {
await this.updateOrCreatePerceptionEffect(token.actor, { perception: value });
} else {
while (!stealthy.perceptionToActor) {
if (this.findPerceptionEffect(actor)) break;
await this.bankRollOnToken(token, 'perception', value);
return;
}
await this.updateOrCreatePerceptionEffect(token.actor, { perception: value });
}

rollStealth() {
Expand Down

0 comments on commit a280bf9

Please sign in to comment.