diff --git a/changelog.md b/changelog.md index ba8923d..fd515d5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog +## [1.1.6] 2021-07-03 +### Bugfix +- Pf2E Fix expending and regaining spell slots in pf2e thanks to Drental +- SWADE BR2 Update swade-br2sw from zk-sn + ## [1.1.5] 2021-06-26 ### Bugfix - DND5e fixes for a variety of issues thanks to benbarbour diff --git a/scripts/rollHandlers/pf2e/pf2e-base.js b/scripts/rollHandlers/pf2e/pf2e-base.js index ac6e517..25737d3 100644 --- a/scripts/rollHandlers/pf2e/pf2e-base.js +++ b/scripts/rollHandlers/pf2e/pf2e-base.js @@ -231,9 +231,9 @@ export class RollHandlerBasePf2e extends RollHandler { let update; if (slot === 'focus') - update = [{id: spellbook.id, data: { focus: {points: value}}}]; + update = [{_id: spellbook.id, data: { focus: {points: value}}}]; else - update = [{id: spellbook.id, data: {slots: {[slot]: {value: value}}}}]; + update = [{_id: spellbook.id, data: { slots: {[slot]: {value: value}}}}]; await Item.updateDocuments(update, {parent: actor}); Hooks.callAll('forceUpdateTokenActionHUD'); @@ -408,7 +408,7 @@ export class RollHandlerBasePf2e extends RollHandler { const key = `data.slots.slot${level}.prepared.${spellSlot}`; const options = { - id: spellbookId, + _id: spellbookId, }; options[key] = { expended: true, diff --git a/scripts/rollHandlers/swade/swade-br2sw.js b/scripts/rollHandlers/swade/swade-br2sw.js index 510084f..9175635 100644 --- a/scripts/rollHandlers/swade/swade-br2sw.js +++ b/scripts/rollHandlers/swade/swade-br2sw.js @@ -84,13 +84,16 @@ export class RollHandlerBR2SWSwade extends RollHandler { update.data.status[status] = !actor.data.data.status[status]; await actor.update(update); - - const effect = CONFIG.SWADE.statusEffects.find(e=>e.id===actionId); - const existingOnToken = actor.effects.find(e => e.getFlag("core", "statusId") === actionId); - - if (!existingOnToken == !existingOnSheet) { - canvas.tokens.get(tokenId).toggleEffect(effect); - } + // SWADE system will eventually set the active effect on the token, this future-proofs it so duplicate effects don't occur + setTimeout(() => { + const existingOnToken = actor.effects.find(e => e.getFlag("core", "statusId") === actionId); + + if (!existingOnToken == !existingOnSheet) { + const effect = CONFIG.SWADE.statusEffects.find(e=>e.id===actionId); + effect["flags.core.statusId"] = actionId; + canvas.tokens.get(tokenId).toggleEffect(effect); + } + }, 10); } /** @private */