Skip to content

Commit

Permalink
Fix Remove Death Saves on Long Rest
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkinabout committed Jan 13, 2025
1 parent fb9f318 commit dda0e8f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/house-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ function updateDeathSaves (source, actor, data, options) {

if (typeof currentValue === 'undefined') return

if (source === 'regainHp' && removeDeathSaves.regainHp[type] < 3 && foundry.utils.hasProperty(data, 'system.attributes.hp.value')) {
if (source === 'regainHp' && !options.isRest && removeDeathSaves.regainHp[type] < 3 && foundry.utils.hasProperty(data, 'system.attributes.hp.value')) {
const previousHp = options.customDnd5e.hp.value
const previousDeathValue = options.customDnd5e.death[type]
const newDeathValue = (previousHp === 0) ? Math.max(previousDeathValue - removeDeathSaves.regainHp[type], 0) : previousDeathValue
Expand Down Expand Up @@ -881,11 +881,11 @@ function capturePreviousData (actor, data, options, userId) {

options.customDnd5e = {
hp: {
value: actor.system.attributes.hp.value
value: actor.system?.attributes?.hp?.value
},
death: {
success: actor.system.attributes.death.success,
failure: actor.system.attributes.death.failure
success: actor.system?.attributes?.death?.success,
failure: actor.system?.attributes?.death?.failure
}
}

Expand Down

0 comments on commit dda0e8f

Please sign in to comment.