Improved naming of attribute properties

This commit is contained in:
WBHarry 2025-06-01 16:04:50 +02:00
parent b9c5c3c753
commit 84a41912a7
3 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ const fields = foundry.data.fields;
const attributeField = () =>
new fields.SchemaField({
data: new fields.SchemaField({
value: new fields.NumberField({ initial: 0, integer: true }),
bonus: new fields.NumberField({ initial: 0, integer: true }),
base: new fields.NumberField({ initial: 0, integer: true })
})
});
@ -330,7 +330,7 @@ export default class DhpPC extends foundry.abstract.TypeDataModel {
for (var attributeKey in this.traits) {
const attribute = this.traits[attributeKey];
attribute.data.total = attribute.data.base + attribute.data.value;
attribute.data.value = attribute.data.base + attribute.data.bonus;
}
this.evasion.value = (this.class?.system?.evasion ?? 0) + this.evasion.bonuses;

View file

@ -46,7 +46,7 @@ export default class DhpActor extends Actor {
}
var traitsUpdate = changes.traits.reduce((acc, trait) => {
acc[`${trait}.data.value`] = this.system.traits[trait].data.value - 1;
acc[`${trait}.data.bonus`] = this.system.traits[trait].data.bonus - 1;
return acc;
}, {});
@ -191,7 +191,7 @@ export default class DhpActor extends Actor {
}
var traitsUpdate = changes.traits.reduce((acc, trait) => {
acc[`${trait}.data.value`] = this.system.traits[trait].data.value + 1;
acc[`${trait}.data.bonus`] = this.system.traits[trait].data.bonus + 1;
return acc;
}, {});

View file

@ -22,7 +22,7 @@
{{/each}}
</select>
{{else}}
<div class="attribute-text {{#if (lt attribute.data.total 0)}}negative{{/if}}">{{attribute.data.total}}</div>
<div class="attribute-text {{#if (lt attribute.data.value 0)}}negative{{/if}}">{{attribute.data.value}}</div>
{{/if}}
<img src="systems/daggerheart/assets/AttributeShield.svg" />
<div>