Various items fixes and enhancements

This commit is contained in:
2024-12-09 16:02:40 +01:00
parent 9775ec9fa1
commit 1de2927d93
51 changed files with 2102 additions and 574 deletions

View File

@ -52,6 +52,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
bonus: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
schema.grit = new fields.SchemaField({
starting: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
earned: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
current: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
@ -87,6 +88,17 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
/** @override */
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Character"]
prepareDerivedData() {
super.prepareDerivedData();
let grit = 0
for (let c in this.characteristics) {
if (SYSTEM.CHARACTERISTICS_MAJOR[c.id]) {
grit += this.characteristics[c].value
}
}
this.grit.starting = Math.round(grit / 6)
}
/**
* Rolls a dice for a character.
* @param {("save"|"resource|damage")} rollType The type of the roll.