[Add] Hope/Scar Interplay (#1531)

* Migrated character.maxHope to homebrew settings

* Added a visual for scars

* .

* .
This commit is contained in:
WBHarry 2026-01-15 01:24:18 +01:00 committed by GitHub
parent 70f4e5f4e5
commit 816bfe0a29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 33 additions and 2 deletions

View file

@ -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: new fields.SchemaField({
value: new fields.NumberField({
initial: 2,
min: 0,
integer: true,
label: 'DAGGERHEART.GENERAL.hope'
})
})
}),
traits: new fields.SchemaField({
agility: attributeField('DAGGERHEART.CONFIG.Traits.agility.name'),
@ -640,7 +647,9 @@ export default class DhCharacter extends BaseDataActor {
? armor.system.baseThresholds.severe + this.levelData.level.current
: this.levelData.level.current * 2
};
this.resources.hope.max -= this.scars;
const globalHopeMax = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxHope;
this.resources.hope.max = globalHopeMax - this.scars;
this.resources.hitPoints.max += this.class.value?.system?.hitPoints ?? 0;
}
@ -729,6 +738,8 @@ export default class DhCharacter extends BaseDataActor {
static migrateData(source) {
if (typeof source.scars === 'object') source.scars = 0;
if (source.resources.hope.max) source.scars = Math.max(6 - source.resources.hope.max, 0);
return super.migrateData(source);
}
}