diff --git a/ChangeLog.md b/ChangeLog.md index 7954a17..b81625e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -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 diff --git a/scripts/engine.js b/scripts/engine.js index 37a2029..672b6e6 100644 --- a/scripts/engine.js +++ b/scripts/engine.js @@ -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) { @@ -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() {