mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[Feature] Damage Reduction Rules (#574)
* More rules * Updated some cards with damageReduction * Fixed Endurance and HighStamina Features * More style improvements
This commit is contained in:
parent
6bdeccfbf9
commit
02a8a9c313
59 changed files with 640 additions and 245 deletions
|
|
@ -464,14 +464,17 @@ export default class DhpActor extends Actor {
|
|||
}
|
||||
|
||||
#canReduceDamage(hpDamage, type) {
|
||||
const { stressDamageReduction, disabledArmor } = this.system.rules.damageReduction;
|
||||
if (disabledArmor) return false;
|
||||
|
||||
const availableStress = this.system.resources.stress.max - this.system.resources.stress.value;
|
||||
|
||||
const canUseArmor =
|
||||
this.system.armor &&
|
||||
this.system.armor.system.marks.value < this.system.armorScore &&
|
||||
type.every(t => this.system.armorApplicableDamageTypes[t] === true);
|
||||
const canUseStress = Object.keys(this.system.rules.damageReduction.stressDamageReduction).reduce((acc, x) => {
|
||||
const rule = this.system.rules.damageReduction.stressDamageReduction[x];
|
||||
const canUseStress = Object.keys(stressDamageReduction).reduce((acc, x) => {
|
||||
const rule = stressDamageReduction[x];
|
||||
if (damageKeyToNumber(x) <= hpDamage) return acc || (rule.enabled && availableStress >= rule.cost);
|
||||
return acc;
|
||||
}, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue