Skip to content

Commit

Permalink
Merge pull request #38 from cs96and/v11_remove_status_fix
Browse files Browse the repository at this point in the history
Fix for removing statuses in v11
  • Loading branch information
trdischat authored Jul 22, 2023
2 parents dfa4295 + 2a280b5 commit 433c91c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion module/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,17 @@ export class GroupAbilityCheck extends GroupRollApp {
const effectData = CONFIG.statusEffects.find(e => e.id === this.effect);
const tokens = (this.tok2Show === "all" ? this.tokList : ( this.tok2Show === "pass" ? this.tokList.filter(t => t.nat === 'grm-success') : this.tokList.filter(t => t.nat === 'grm-fumble' && t.roll instanceof Roll) ));

const hasStatus = (actor, statusId) => {
if (!isNewerVersion("11", game.version))
return actor.statuses.has(statusId);
else
return actor.effects.some(e => e.getFlag("core", "statusId") === statusId);
}

for (const t of tokens) {
const token = canvas.tokens.get(t.id);
if (token) {
if (active !== token.actor.effects.some(e => e.getFlag("core", "statusId") === effectData.id)) {
if (active !== hasStatus(token.actor, effectData.id)) {
token.toggleEffect(effectData, { active, overlay });
}
}
Expand Down

0 comments on commit 433c91c

Please sign in to comment.