mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
.
This commit is contained in:
parent
1c3e2f019c
commit
5d9a21f033
12 changed files with 260 additions and 108 deletions
|
|
@ -7,21 +7,32 @@ export default class DhRollTable extends foundry.abstract.TypeDataModel {
|
|||
|
||||
return {
|
||||
formulaName: new fields.StringField({
|
||||
// This is to give a name to go together with the core.formula
|
||||
required: true,
|
||||
nullable: false,
|
||||
initial: 'Formula' // Should be a translation
|
||||
initial: 'Roll Formula',
|
||||
label: 'DAGGERHEART.ROLLTABLES.FIELDS.formulaName.label'
|
||||
}),
|
||||
altFormula: new fields.ArrayField(
|
||||
altFormula: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
key: new fields.StringField({
|
||||
required: false,
|
||||
name: new fields.StringField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
blank: true
|
||||
initial: 'Roll Formula',
|
||||
label: 'DAGGERHEART.ROLLTABLES.FIELDS.formulaName.label'
|
||||
}),
|
||||
formula: new FormulaField()
|
||||
formula: new FormulaField({ label: 'Formula Roll', initial: '1d20' })
|
||||
})
|
||||
)
|
||||
),
|
||||
activeAltFormula: new fields.StringField({ nullable: true, initial: null })
|
||||
};
|
||||
}
|
||||
|
||||
getActiveFormula(baseFormula) {
|
||||
return this.activeAltFormula ? (this.altFormula[this.activeAltFormula].formula ?? baseFormula) : baseFormula;
|
||||
}
|
||||
|
||||
static getDefaultFormula = () => ({
|
||||
name: game.i18n.localize('Roll Formula'),
|
||||
formula: '1d20'
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue