Feature/336 damage targeted resources (#376)

* Unify healing & damage

* create DHResourceData

* Damages parts roll

* h

* ChatMessage & takeDamage updates

* Adapt healing

* No, there was not a console.log !
This commit is contained in:
Dapoulp 2025-07-19 15:48:50 +02:00 committed by GitHub
parent 26376b49db
commit 7cbbb3168e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 415 additions and 232 deletions

View file

@ -43,10 +43,11 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.config = CONFIG.DH;
context.title = this.config.title
? this.config.title
: game.i18n.localize('DAGGERHEART.EFFECTS.ApplyLocations.damageRoll.name');
context.extraFormula = this.config.extraFormula;
// context.extraFormula = this.config.extraFormula;
context.formula = this.roll.constructFormula(this.config);
context.directDamage = this.config.directDamage;
context.selectedRollMode = this.config.selectedRollMode;
@ -55,13 +56,12 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
label,
icon
}));
return context;
}
static updateRollConfiguration(_event, _, formData) {
const { ...rest } = foundry.utils.expandObject(formData.object);
this.config.extraFormula = rest.extraFormula;
foundry.utils.mergeObject(this.config.roll, rest.roll)
this.config.selectedRollMode = rest.selectedRollMode;
this.render();

View file

@ -10,12 +10,12 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
this.reject = reject;
this.actor = actor;
this.damage = damage;
const canApplyArmor = damageType.every(t => actor.system.armorApplicableDamageTypes[t] === true);
const maxArmorMarks = canApplyArmor
? Math.min(
actor.system.armorScore - actor.system.armor.system.marks.value,
actor.system.rules.damageReduction.maxArmorMarked.total
actor.system.rules.damageReduction.maxArmorMarked.value
)
: 0;
@ -100,7 +100,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap
context.armorScore = this.actor.system.armorScore;
context.armorMarks = currentMarks;
context.basicMarksUsed =
selectedArmorMarks.length === this.actor.system.rules.damageReduction.maxArmorMarked.total;
selectedArmorMarks.length === this.actor.system.rules.damageReduction.maxArmorMarked.value;
const stressReductionStress = this.availableStressReductions
? stressReductions.reduce((acc, red) => acc + red.cost, 0)