Skip to content

Commit

Permalink
Merge pull request #209 from sasquach45932/master
Browse files Browse the repository at this point in the history
New special duration: NextDamageRoll
  • Loading branch information
ClipplerBlood authored Oct 8, 2024
2 parents 21e403c + 23053d7 commit 748918e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/module/active-effects/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})

Expand Down
12 changes: 6 additions & 6 deletions src/module/actor/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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 ||
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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()
}

Expand Down
6 changes: 6 additions & 0 deletions src/module/chat/chat-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 748918e

Please sign in to comment.