Describe the bugGenericEstimationProvider ignores the "Hit Points Attribute Data Path" (core.custom.FractionHP) setting on tokens with zero HP. The following code is responsible:
const hpPath = sGet("core.custom.FractionHP");
let hp = (hpPath && getNestedData(token, hpPath))
|| (game.system.primaryTokenAttribute
&& getNestedData(token, `actor.system.${game.system.primaryTokenAttribute}`))
|| token.actor.system.attributes?.hp
|| token.actor.system.hp;
If the value returned by getNestedData is zero, the || operator will incorrectly evaluate the alternative paths. token.actor.system.hp is an object rather than a number in the system I tested with, so the module throws errors on each token with zero HP.
Describe the bug
GenericEstimationProvider
ignores the "Hit Points Attribute Data Path" (core.custom.FractionHP
) setting on tokens with zero HP. The following code is responsible:If the value returned by
getNestedData
is zero, the||
operator will incorrectly evaluate the alternative paths.token.actor.system.hp
is an object rather than a number in the system I tested with, so the module throws errors on each token with zero HP.To Reproduce
actor.system.hp.value
Expected behavior The "Hit Points Attribute Data Path" should be used regardless of the underlying HP value.
Game Specifics (please complete the following information):