diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index 51ce5bab..dd5f35fc 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -725,6 +725,7 @@ export default class CharacterSheet extends DHBaseActorSheet { }) }; const result = await this.document.diceRoll(config); + if (!result) return; /* This could be avoided by baking config.costs into config.resourceUpdates. Didn't feel like messing with it at the time */ const costResources = result.costs diff --git a/module/config/generalConfig.mjs b/module/config/generalConfig.mjs index 3f49f7aa..37894644 100644 --- a/module/config/generalConfig.mjs +++ b/module/config/generalConfig.mjs @@ -496,6 +496,8 @@ export const diceTypes = { d20: 'd20' }; +export const dieFaces = [4, 6, 8, 10, 12, 20]; + export const multiplierTypes = { prof: 'Proficiency', cast: 'Spellcast', diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index 7a30fb5a..f6ab7e3a 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -281,18 +281,20 @@ export default class DhCharacter extends BaseDataActor { }) }), dualityRoll: new fields.SchemaField({ - defaultHopeDice: new fields.StringField({ + defaultHopeDice: new fields.NumberField({ nullable: false, required: true, - choices: CONFIG.DH.GENERAL.diceTypes, - initial: CONFIG.DH.GENERAL.diceTypes.d12, + integer: true, + choices: CONFIG.DH.GENERAL.dieFaces, + initial: 12, label: 'DAGGERHEART.ACTORS.Character.defaultHopeDice' }), - defaultFearDice: new fields.StringField({ + defaultFearDice: new fields.NumberField({ nullable: false, required: true, - choices: CONFIG.DH.GENERAL.diceTypes, - initial: CONFIG.DH.GENERAL.diceTypes.d12, + integer: true, + choices: CONFIG.DH.GENERAL.dieFaces, + initial: 12, label: 'DAGGERHEART.ACTORS.Character.defaultFearDice' }) }), diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index a75efaaf..155d6aa5 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -132,12 +132,10 @@ export default class DualityRoll extends D20Roll { } const { defaultHopeDice, defaultFearDice } = this.data.rules.dualityRoll; - const hopeFaces = Number.parseInt(defaultHopeDice.substring(1)); - const fearFaces = Number.parseInt(defaultFearDice.substring(1)); - this.terms[0] = new foundry.dice.terms.Die({ faces: hopeFaces }); + this.terms[0] = new foundry.dice.terms.Die({ faces: defaultHopeDice }); this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' }); - this.terms[2] = new foundry.dice.terms.Die({ faces: fearFaces }); + this.terms[2] = new foundry.dice.terms.Die({ faces: defaultFearDice }); } applyAdvantage() {