mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
Update armor slot handling
This commit is contained in:
parent
4bdafeff6d
commit
af3a415e56
10 changed files with 56 additions and 72 deletions
|
|
@ -35,7 +35,14 @@ export default class DhCharacter extends BaseDataActor {
|
|||
'DAGGERHEART.ACTORS.Character.maxHPBonus'
|
||||
),
|
||||
stress: resourceField(6, 0, 'DAGGERHEART.GENERAL.stress', true),
|
||||
hope: resourceField(6, 2, 'DAGGERHEART.GENERAL.hope')
|
||||
hope: resourceField(6, 2, 'DAGGERHEART.GENERAL.hope'),
|
||||
armor: resourceField(
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
true,
|
||||
''
|
||||
)
|
||||
}),
|
||||
traits: new fields.SchemaField({
|
||||
agility: attributeField('DAGGERHEART.CONFIG.Traits.agility.name'),
|
||||
|
|
@ -631,11 +638,8 @@ export default class DhCharacter extends BaseDataActor {
|
|||
this.resources.hope.value = Math.min(baseHope, this.resources.hope.max);
|
||||
this.attack.roll.trait = this.rules.attack.roll.trait ?? this.attack.roll.trait;
|
||||
|
||||
this.resources.armor = {
|
||||
value: this.armor?.system?.marks?.value ?? 0,
|
||||
max: this.armorScore,
|
||||
isReversed: true
|
||||
};
|
||||
this.resources.armor.max = this.armorScore;
|
||||
if(this.resources.armor.value > this.resources.armor.max) this.resources.armor.value = this.resources.armor.max;
|
||||
|
||||
this.attack.damage.parts[0].value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,9 +55,14 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
|||
}
|
||||
|
||||
get action() {
|
||||
const actionItem = this.actionItem;
|
||||
if (!actionItem || !this.source.action) return null;
|
||||
return actionItem.system.actionsList?.find(a => a.id === this.source.action);
|
||||
const actionActor = this.actionActor,
|
||||
actionItem = this.actionItem;
|
||||
if (!this.source.action) return null;
|
||||
if(actionItem)
|
||||
return actionItem.system.actionsList?.find(a => a.id === this.source.action);
|
||||
else if(actionActor?.system.attack?._id === this.source.action)
|
||||
return actionActor.system.attack
|
||||
return null;
|
||||
}
|
||||
|
||||
get targetMode() {
|
||||
|
|
|
|||
|
|
@ -187,14 +187,6 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
if (allowed === false) return false;
|
||||
|
||||
addLinkedItemsDiff(changed.system?.features, this.features, options);
|
||||
|
||||
const autoSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation);
|
||||
const armorChanged =
|
||||
changed.system?.marks?.value !== undefined && changed.system.marks.value !== this.marks.value;
|
||||
if (armorChanged && autoSettings.resourceScrollTexts && this.parent.parent?.type === 'character') {
|
||||
const armorData = getScrollTextData(this.parent.parent.system.resources, changed.system.marks, 'armor');
|
||||
options.scrollingTextData = [armorData];
|
||||
}
|
||||
}
|
||||
|
||||
_onUpdate(changed, options, userId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue