Added a hpDamageTkenMultiplier rule active effects can modify to multiply the total damage an actor takes from others

This commit is contained in:
WBHarry 2026-01-21 01:03:22 +01:00
parent dc68ae4eee
commit 9f1d53239e
3 changed files with 21 additions and 7 deletions

View file

@ -51,6 +51,11 @@ export const commonActorRules = (extendedData = { damageReduction: {}, attack: {
nullable: false, nullable: false,
initial: 1 initial: 1
}), }),
hpDamageTakenMultiplier: new fields.NumberField({
required: true,
nullable: false,
initial: 1
}),
...(extendedData.attack?.damage ?? {}) ...(extendedData.attack?.damage ?? {})
}) })
}) })

View file

@ -106,16 +106,18 @@ export default class DamageField extends fields.SchemaField {
actor.takeHealing(config.damage).then(updates => targetDamage.push({ token, updates })) actor.takeHealing(config.damage).then(updates => targetDamage.push({ token, updates }))
); );
else { else {
const configDamage = foundry.utils.deepClone(config.damage);
const hpDamageMultiplier = config.actionActor?.system.rules.attack.damage.hpDamageMultiplier ?? 1; const hpDamageMultiplier = config.actionActor?.system.rules.attack.damage.hpDamageMultiplier ?? 1;
if (config.damage.hitPoints) { const hpDamageTakenMultiplier = actor.system.rules.attack.damage.hpDamageTakenMultiplier;
for (const part of config.damage.hitPoints.parts) { if (configDamage.hitPoints) {
part.total = part.total * hpDamageMultiplier; for (const part of configDamage.hitPoints.parts) {
part.total = part.total * hpDamageMultiplier * hpDamageTakenMultiplier;
} }
} }
damagePromises.push( damagePromises.push(
actor actor
.takeDamage(config.damage, config.isDirect) .takeDamage(configDamage, config.isDirect)
.then(updates => targetDamage.push({ token, updates })) .then(updates => targetDamage.push({ token, updates }))
); );
} }

View file

@ -336,7 +336,14 @@
"range": "melee" "range": "melee"
} }
}, },
"changes": [], "changes": [
{
"key": "system.rules.attack.damage.hpDamageTakenMultiplier",
"mode": 5,
"value": "2",
"priority": null
}
],
"disabled": false, "disabled": false,
"duration": { "duration": {
"startTime": null, "startTime": null,
@ -350,8 +357,8 @@
"description": "", "description": "",
"tint": "#ffffff", "tint": "#ffffff",
"statuses": [ "statuses": [
"restrained", "vulnerable",
"vulnerable" "restrained"
], ],
"sort": 0, "sort": 0,
"flags": {}, "flags": {},