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

@ -514,8 +514,7 @@ export default class DhpActor extends Actor {
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 &&
this.system.resources.armor.value < this.system.resources.armor.max &&
type.every(t => this.system.armorApplicableDamageTypes[t] === true);
const canUseStress = Object.keys(stressDamageReduction).reduce((acc, x) => {
const rule = stressDamageReduction[x];
@ -558,7 +557,6 @@ export default class DhpActor extends Actor {
if (
this.type === 'character' &&
!isDirect &&
this.system.armor &&
this.#canReduceDamage(hpDamage.value, hpDamage.damageTypes)
) {
const armorSlotResult = await this.owner.query(
@ -682,14 +680,6 @@ export default class DhpActor extends Actor {
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear) + r.value
);
break;
case 'armor':
if (this.system.armor?.system?.marks) {
updates.armor.resources['system.marks.value'] = Math.max(
Math.min(this.system.armor.system.marks.value + r.value, this.system.armorScore),
0
);
}
break;
default:
if (this.system.resources?.[r.key]) {
updates.actor.resources[`system.resources.${r.key}.value`] = Math.max(