diff --git a/src/reminders.js b/src/reminders.js index 2b84583..935738a 100644 --- a/src/reminders.js +++ b/src/reminders.js @@ -213,7 +213,9 @@ export class AbilityCheckReminder extends AbilityBaseReminder { } get disadvantageConditions() { - return super.disadvantageConditions().push("advReminderDisadvantageAbility"); + const conditions = super.disadvantageConditions; + conditions.push("advReminderDisadvantageAbility"); + return conditions; } } @@ -242,7 +244,8 @@ export class AbilitySaveReminder extends AbilityBaseReminder { } get disadvantageConditions() { - const conditions = super.disadvantageConditions().push("advReminderDisadvantageSave"); + const conditions = super.disadvantageConditions; + conditions.push("advReminderDisadvantageSave"); if (this.abilityId === "dex") conditions.push("advReminderDisadvantageDexSave"); return conditions; } diff --git a/test/common.js b/test/common.js index a9aaaf8..19ccdd7 100644 --- a/test/common.js +++ b/test/common.js @@ -4,13 +4,36 @@ export default function commonTestInit() { globalThis.createActorWithFlags = (...keys) => { const actor = { flags: {}, + hasConditionEffect: () => false, + system: {}, }; keys.forEach((k) => setProperty(actor, k, true)); return actor; }; + globalThis.CONFIG = {}; + globalThis.CONFIG.DND5E = {}; + globalThis.CONFIG.DND5E.conditionEffects = {}; + // copied from Foundry + function filter(test) { + const filtered = new Set(); + let i = 0; + for ( const v of this ) { + if ( test(v, i, this) ) filtered.add(v); + i++; + } + return filtered; + } + function toObject() { + return Array.from(this); + } + Object.defineProperties(Set.prototype, { + filter: {value: filter}, + toObject: {value: toObject} + }); + globalThis.setProperty = (object, key, value) => { // split the key into parts, removing the last one const parts = key.split(".");