diff --git a/ChangeLog.md b/ChangeLog.md index 0e26cb0..5a674db 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +# v1.11.0 +* If an avoiding combatant has its initiative set manually by the GM using the 'Set as *Combatant's* initiative' button on a check result card, update that card with visibility results when combat is started. +* Fix a benign error that happened when setting/clearing hidden/undetected conditions via token HUD on a token that didn't have any pf2e-perception status flags on it. + # v1.10.1 * messed up the release process, bumping version to clear it. diff --git a/esmodules/combat.js b/esmodules/combat.js index 7b547cf..ef3f570 100644 --- a/esmodules/combat.js +++ b/esmodules/combat.js @@ -169,9 +169,9 @@ Hooks.once('init', () => { for (const avoider of avoiders) { // log('avoider', avoider); - // Find the last initiative chat for the avoider + // Find the last card with a check roll matching initiative for the avoider const messages = game.messages.contents.filter((m) => - m.speaker.token === avoider.tokenId && m.flags?.core?.initiativeRoll + m.speaker.token === avoider.tokenId && m.rolls[0].total === avoider.initiative ); if (!messages.length) { log(`Couldn't find initiative card for ${avoider.token.name}`); diff --git a/esmodules/main.js b/esmodules/main.js index 5ad7df8..eabbd84 100644 --- a/esmodules/main.js +++ b/esmodules/main.js @@ -87,7 +87,7 @@ Hooks.once('ready', () => { // Remove any ids that perception is tracking const perceptionData = token.flags?.[PF2E_PERCEPTION_ID]?.data; - if (!Object.keys(perceptionData).length) return; + if (!perceptionData || !Object.keys(perceptionData).length) return; let tokenUpdate = {}; for (let id in perceptionData) { tokenUpdate[`flags.${PF2E_PERCEPTION_ID}.data.-=${id}`] = true;