mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 06:26:13 +01:00
[Feature] RollTable Improvements (#1552)
* Initial - Branch Test * reorganized path for better usage * something to mess with * registration things * . * root-template error * pushing in for the day * hook? * help? * . * implementation initial * updated comment * overcomplicated it * . * Added Formula select to view mode * . * Prettied up roll-results template * Removed SRD table descriptions * Improved draw result description css * Fallback for default dark dice * . --------- Co-authored-by: Nikhil Nagarajan <potter.nikhil@gmail.com>
This commit is contained in:
parent
fdb6412c8c
commit
a78ef1f70c
20 changed files with 660 additions and 10 deletions
|
|
@ -1,6 +1,7 @@
|
|||
export { default as DhCombat } from './combat.mjs';
|
||||
export { default as DhCombatant } from './combatant.mjs';
|
||||
export { default as DhTagTeamRoll } from './tagTeamRoll.mjs';
|
||||
export { default as DhRollTable } from './rollTable.mjs';
|
||||
export { default as RegisteredTriggers } from './registeredTriggers.mjs';
|
||||
|
||||
export * as countdowns from './countdowns.mjs';
|
||||
|
|
|
|||
38
module/data/rollTable.mjs
Normal file
38
module/data/rollTable.mjs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import FormulaField from './fields/formulaField.mjs';
|
||||
|
||||
//Extra definitions for RollTable
|
||||
export default class DhRollTable extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
return {
|
||||
formulaName: new fields.StringField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
initial: 'Roll Formula',
|
||||
label: 'DAGGERHEART.ROLLTABLES.FIELDS.formulaName.label'
|
||||
}),
|
||||
altFormula: new fields.TypedObjectField(
|
||||
new fields.SchemaField({
|
||||
name: new fields.StringField({
|
||||
required: true,
|
||||
nullable: false,
|
||||
initial: 'Roll Formula',
|
||||
label: 'DAGGERHEART.ROLLTABLES.FIELDS.formulaName.label'
|
||||
}),
|
||||
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