diff --git a/src/lang/en.json b/src/lang/en.json index c218e68d..c9877e96 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -631,6 +631,7 @@ "DL.SpecialDurationTurnStart": "Turn Start: Expires at the start of the targets's next turn (in combat)", "DL.SpecialDurationTurnStartSource": "Turn Start: Expires at the start of the source actor's next turn (in combat)", "DL.SpecialDurationNextD20Roll": "Next d20 Roll: Expires at the targets's next Challenge/Attack Roll", + "DL.SpecialDurationNextDamageRoll": "Next Damage Roll: Expires at the targets's next Damage Roll", "DL.SpecialDurationRestComplete": "Rest Complete: Expires when the targets complete rest", "DL.SpellAftereffect": "Aftereffect", "DL.SpellArea": "Area", diff --git a/src/module/active-effects/effects.js b/src/module/active-effects/effects.js index 79244fed..a30bfd90 100644 --- a/src/module/active-effects/effects.js +++ b/src/module/active-effects/effects.js @@ -193,7 +193,7 @@ Hooks.on('renderActiveEffectConfig', (app, html) => { dropDownConfig({ specialDuration: 'specialDuration', - values: ['None', 'TurnStart', 'TurnEnd', 'TurnStartSource', 'TurnEndSource','NextD20Roll','RestComplete'], + values: ['None', 'TurnStart', 'TurnEnd', 'TurnStartSource', 'TurnEndSource','NextD20Roll','NextDamageRoll','RestComplete'], default_value: 'None', }) diff --git a/src/module/actor/actor.js b/src/module/actor/actor.js index 60a42ee8..679e6a8d 100644 --- a/src/module/actor/actor.js +++ b/src/module/actor/actor.js @@ -427,7 +427,7 @@ export class DemonlordActor extends Actor { for (let effect of this.appliedEffects) { const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') - if (!(specialDuration?.length > 0)) continue + // if (!(specialDuration?.length > 0)) continue if (specialDuration === 'NextD20Roll') { let nAttackAttribute = attackAttribute.length ? attackAttribute : 'None' if ( @@ -509,7 +509,7 @@ export class DemonlordActor extends Actor { for (let effect of this.appliedEffects) { const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') - if (!(specialDuration?.length > 0)) continue + // if (!(specialDuration?.length > 0)) continue if (specialDuration === 'NextD20Roll') { if ( effect.changes.find(e => e.key.includes('system.bonuses.challenge.boons.all')) || !effect.changes.length || @@ -591,7 +591,7 @@ export class DemonlordActor extends Actor { for (let effect of this.appliedEffects) { const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') - if (!(specialDuration?.length > 0)) continue + // if (!(specialDuration?.length > 0)) continue if (specialDuration === 'NextD20Roll') { let nAttackAttribute = attackAttribute.length ? attackAttribute : 'None' if ( @@ -690,7 +690,7 @@ export class DemonlordActor extends Actor { for (let effect of this.appliedEffects) { const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') - if (!(specialDuration?.length > 0)) continue + // if (!(specialDuration?.length > 0)) continue if (specialDuration === 'NextD20Roll') { let nAttackAttribute = attackAttribute.length ? attackAttribute : 'None' if ( @@ -795,7 +795,7 @@ export class DemonlordActor extends Actor { for (let effect of this.appliedEffects) { const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') - if (!(specialDuration?.length > 0)) continue + // if (!(specialDuration?.length > 0)) continue if (specialDuration === 'NextD20Roll') { let nAttackAttribute = attackAttribute.length ? attackAttribute : 'None' if ( @@ -949,7 +949,7 @@ export class DemonlordActor extends Actor { for (let effect of this.appliedEffects) { const specialDuration = foundry.utils.getProperty(effect, "flags.specialDuration") - if (!(specialDuration?.length > 0)) continue + // if (!(specialDuration?.length > 0)) continue if (specialDuration === 'RestComplete') await effect?.delete() } diff --git a/src/module/chat/chat-listeners.js b/src/module/chat/chat-listeners.js index 4f696644..32b9cf8b 100644 --- a/src/module/chat/chat-listeners.js +++ b/src/module/chat/chat-listeners.js @@ -56,6 +56,12 @@ async function _onChatRollDamage(event) { const li = event.currentTarget const token = li.closest('.demonlord') const actor = _getChatCardActor(token) + + for (let effect of tokenManager.getTokenByActorId(actor.id).actor.appliedEffects) { + const specialDuration = foundry.utils.getProperty(effect, 'flags.specialDuration') + if (specialDuration === 'NextDamageRoll') await effect?.delete() + } + const item = li.children[0] var damageformula = item.dataset.damage const damagetype = item.dataset.damagetype