Skip to content

Commit

Permalink
Prevent double deletion when times-up expires effect
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed Dec 28, 2022
1 parent 00e02c7 commit 0b3874d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,7 @@ Correct a missing deprecated data reference.
Try and prevent the double effect deletion.
HP Check could misfire effect application due to bad HP logic.
Auras in 5e will support the `isSuppressed` flag, and triggered by attunement and equipped status if it's an item. (@DarkByteZero)

# 0.5.4

Don't trigger effect removal when times-up expires an effect as it cleans up for us.
10 changes: 6 additions & 4 deletions src/AAhooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ Hooks.on("updateActiveEffect", (effect, _update) => {
Hooks.on("deleteActiveEffect", (effect, options) => {
if (canvas.scene === null) { if (AAdebug) { console.log("Active Auras disabled due to no canvas") } return }
if (!AAgm) return;
let applyStatus = effect.flags?.ActiveAuras?.applied;
let auraStatus = effect.flags?.ActiveAuras?.isAura;
if (!applyStatus && auraStatus) {
if (AAdebug) console.log("deleteActiveEffect, collate auras true false", { effect, update: options });
const applyStatus = effect.flags?.ActiveAuras?.applied;
const auraStatus = effect.flags?.ActiveAuras?.isAura;
const timeUpExpiry = options["expiry-reason"]?.startsWith("times-up:");

if (!applyStatus && auraStatus && !timeUpExpiry) {
if (AAdebug) console.log("deleteActiveEffect, collate auras true false", { effect, options });
debouncedCollate(canvas.scene.id, false, true, "deleteActiveEffect");
}
});
Expand Down

0 comments on commit 0b3874d

Please sign in to comment.