Tested that triggers fire for all properties.

Fixed some action engine issues found.
This commit is contained in:
ThaumRystra
2024-11-07 00:22:46 +02:00
parent 057772c60a
commit 2c431293e0
9 changed files with 197 additions and 75 deletions

View File

@@ -23,11 +23,14 @@ export default async function applyDamageProperty(
const prop = task.prop;
const scope = getEffectiveActionScope(action);
// Skip if there is no parse node to work with
if (!prop.amount?.parseNode) return;
// Choose target
const damageTargets = prop.target === 'self' ? [action.creatureId] : task.targetIds;
// Skip if there is no parse node to work with
if (!prop.amount?.valueNode) {
return applyDefaultAfterPropTasks(action, prop, damageTargets, inputProvider);
}
// Determine if the hit is critical
const criticalHit = await getConstantValueFromScope('~criticalHit', scope)
&& prop.damageType !== 'healing'; // Can't critically heal
@@ -91,9 +94,9 @@ export default async function applyDamageProperty(
}
// Memoise the damage suffix for the log
const suffix = (criticalHit ? ' critical ' : ' ') +
const suffix = (criticalHit ? 'critical ' : '') +
prop.damageType +
(prop.damageType !== 'healing' ? ' damage ' : '');
(prop.damageType !== 'healing' ? ' damage' : '');
// If there is a save, calculate the save damage
let damageOnSave, saveProp, saveRoll;