Update armor slot handling

This commit is contained in:
Dapoolp 2025-09-02 14:26:50 +02:00
parent 4bdafeff6d
commit af3a415e56
10 changed files with 56 additions and 72 deletions

View file

@ -20,7 +20,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
);
const canApplyArmor = damageType.every(t => actor.system.armorApplicableDamageTypes[t] === true);
const availableArmor = actor.system.armorScore - actor.system.armor.system.marks.value;
const availableArmor = actor.system.resources.armor.max - actor.system.resources.armor.value;
const maxArmorMarks = canApplyArmor ? availableArmor : 0;
const armor = [...Array(maxArmorMarks).keys()].reduce((acc, _) => {
@ -116,7 +116,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
const { selectedArmorMarks, selectedStressMarks, stressReductions, currentMarks, currentDamage } =
this.getDamageInfo();
context.armorScore = this.actor.system.armorScore;
context.armorScore = this.actor.system.resources.armor.max;
context.armorMarks = currentMarks;
context.basicMarksUsed =
selectedArmorMarks.length === this.actor.system.rules.damageReduction.maxArmorMarked.value;
@ -165,7 +165,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
? Object.values(this.availableStressReductions).filter(red => red.selected)
: [];
const currentMarks =
this.actor.system.armor.system.marks.value + selectedArmorMarks.length + selectedStressMarks.length;
this.actor.system.resources.armor.value + selectedArmorMarks.length + selectedStressMarks.length;
const armorMarkReduction =
selectedArmorMarks.length * this.actor.system.rules.damageReduction.increasePerArmorMark;
@ -207,7 +207,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
}
if (this.rulesOn) {
if (!currentMark.selected && currentMarks === this.actor.system.armorScore) {
if (!currentMark.selected && currentMarks === this.actor.system.resources.armor.max) {
ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noAvailableArmorMarks'));
return;
}