diff --git a/lang/en.json b/lang/en.json index d6452d30..7fe6f341 100755 --- a/lang/en.json +++ b/lang/en.json @@ -237,10 +237,6 @@ "unequip": "Unequip", "useItem": "Use Item" }, - "defaultHopeDice": "Default Hope Dice", - "defaultFearDice": "Default Fear Dice", - "defaultAdvantageDice": "Default Advantage Dice", - "defaultDisadvantageDice": "Default Disadvantage Dice", "disadvantageSources": { "label": "Disadvantage Sources", "hint": "Add single words or short text as reminders and hints of what a character has disadvantage on." @@ -306,6 +302,16 @@ }, "noPartner": "No Partner selected" }, + "Creature": { + "rules": { + "roll": { + "hope": { "label": "Default Hope Dice Index", "hint": "Index for the default hope dice. 0=d4, 1=d6, 2=d8, 3=d10, 4=d12, 5=d20" }, + "fear": { "label": "Default Fear Dice Index", "hint": "Index for the default fear dice. 0=d4, 1=d6, 2=d8, 3=d10, 4=d12, 5=d20" }, + "advantage": { "label": "Default Advantage Dice Index", "hint": "Index for the default advantage dice. 0=d4, 1=d6, 2=d8, 3=d10, 4=d12, 5=d20" }, + "disadvantage": { "label": "Default Disadvantage Dice Index", "hint": "Index for the default disadvantage dice. 0=d4, 1=d6, 2=d8, 3=d10, 4=d12, 5=d20" } + } + } + }, "Environment": { "FIELDS": { "description": { diff --git a/module/applications/dialogs/d20RollDialog.mjs b/module/applications/dialogs/d20RollDialog.mjs index 067aa473..926b3a80 100644 --- a/module/applications/dialogs/d20RollDialog.mjs +++ b/module/applications/dialogs/d20RollDialog.mjs @@ -176,11 +176,11 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio this.config.roll.advantage = this.config.roll.advantage === advantage ? 0 : advantage; - if (this.config.roll.advantage === 1 && this.config.data.rules.roll.defaultAdvantageDice) { - const faces = Number.parseInt(this.config.data.rules.roll.defaultAdvantageDice); + if (this.config.roll.advantage === 1 && this.config.data.rules.roll.advantageFaces) { + const faces = Number.parseInt(this.config.data.rules.roll.advantageFaces); this.roll.advantageFaces = Number.isNaN(faces) ? this.roll.advantageFaces : faces; - } else if (this.config.roll.advantage === -1 && this.config.data.rules.roll.defaultDisadvantageDice) { - const faces = Number.parseInt(this.config.data.rules.roll.defaultDisadvantageDice); + } else if (this.config.roll.advantage === -1 && this.config.data.rules.roll.disadvantageFaces) { + const faces = Number.parseInt(this.config.data.rules.roll.disadvantageFaces); this.roll.advantageFaces = Number.isNaN(faces) ? this.roll.advantageFaces : faces; } diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index 3e85c139..1c1b96a5 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -261,24 +261,6 @@ export default class DhCharacter extends DhCreature { }) } }), - dualityRoll: new fields.SchemaField({ - defaultHopeDice: new fields.NumberField({ - nullable: false, - required: true, - integer: true, - choices: CONFIG.DH.GENERAL.dieFaces, - initial: 12, - label: 'DAGGERHEART.ACTORS.Character.defaultHopeDice' - }), - defaultFearDice: new fields.NumberField({ - nullable: false, - required: true, - integer: true, - choices: CONFIG.DH.GENERAL.dieFaces, - initial: 12, - label: 'DAGGERHEART.ACTORS.Character.defaultFearDice' - }) - }), burden: new fields.SchemaField({ ignore: new fields.BooleanField({ label: 'DAGGERHEART.ACTORS.Character.burden.ignore.label' }) }), @@ -287,29 +269,49 @@ export default class DhCharacter extends DhCreature { label: 'DAGGERHEART.ACTORS.Character.roll.guaranteedCritical.label', hint: 'DAGGERHEART.ACTORS.Character.roll.guaranteedCritical.hint' }), - defaultAdvantageDice: new fields.NumberField({ - nullable: true, + hope: new fields.NumberField({ required: true, integer: true, - choices: CONFIG.DH.GENERAL.dieFaces, - initial: null, - label: 'DAGGERHEART.ACTORS.Character.defaultAdvantageDice' + min: 0, + max: 5, + initial: 4, + label: 'DAGGERHEART.ACTORS.Creature.rules.roll.hope.label', + hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.hope.hint' }), - defaultDisadvantageDice: new fields.NumberField({ - nullable: true, + fear: new fields.NumberField({ required: true, integer: true, - choices: CONFIG.DH.GENERAL.dieFaces, - initial: null, - label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice' + min: 0, + max: 5, + initial: 4, + label: 'DAGGERHEART.ACTORS.Creature.rules.roll.fear.label', + hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.fear.hint' }), + advantage: new fields.NumberField({ + required: true, + integer: true, + min: 0, + max: 5, + initial: 1, + label: 'DAGGERHEART.ACTORS.Creature.rules.roll.advantage.label', + hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.advantage.hint' + }), + disadvantage: new fields.NumberField({ + required: true, + integer: true, + min: 0, + max: 5, + initial: 1, + label: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.label', + hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.hint' + }), + comboDie: new fields.NumberField({ + integer: true, + min: 0, + max: 5, + initial: 0, + }) }), - comboDieIndex: new fields.NumberField({ - integer: true, - min: 0, - max: 5, - initial: 0, - }) }) }; } @@ -765,7 +767,7 @@ export default class DhCharacter extends DhCreature { }); break; case 'comboStrikes': - this.rules.comboDieIndex += 1; + this.rules.roll.comboDie += 1; break; } } @@ -824,6 +826,13 @@ export default class DhCharacter extends DhCreature { isReversed: true }; + /* Add convience Faces properties for all dice */ + const { hope, fear, advantage, disadvantage } = this.rules.roll; + const dice = { hope, fear, advantage, disadvantage }; + for (const dieKey of Object.keys(dice)) { + this.rules.roll[`${dieKey}Faces`] = CONFIG.DH.GENERAL.dieFaces[dice[dieKey]]; + } + this.attack.damage.parts.hitPoints.value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`; } diff --git a/module/data/actor/companion.mjs b/module/data/actor/companion.mjs index a1fa1429..dd00a7e8 100644 --- a/module/data/actor/companion.mjs +++ b/module/data/actor/companion.mjs @@ -63,21 +63,23 @@ export default class DhCompanion extends DhCreature { }) }), roll: new fields.SchemaField({ - defaultAdvantageDice: new fields.NumberField({ - nullable: true, + advantage: new fields.NumberField({ required: true, integer: true, - choices: CONFIG.DH.GENERAL.dieFaces, - initial: null, - label: 'DAGGERHEART.ACTORS.Character.defaultAdvantageDice' + min: 0, + max: 5, + initial: 1, + label: 'DAGGERHEART.ACTORS.Creature.rules.roll.advantage.label', + hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.advantage.hint' }), - defaultDisadvantageDice: new fields.NumberField({ - nullable: true, + disadvantage: new fields.NumberField({ required: true, integer: true, - choices: CONFIG.DH.GENERAL.dieFaces, - initial: null, - label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice' + min: 0, + max: 5, + initial: 1, + label: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.label', + hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.hint' }), }) }), diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index 2448a16d..e16ac5f2 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -11,7 +11,7 @@ export default class DualityRoll extends D20Roll { this.rallyChoices = this.setRallyChoices(); this.guaranteedCritical = options.guaranteedCritical; - const advantageFaces = data.rules?.roll?.defaultAdvantageDice ? Number.parseInt(data.rules.roll.defaultAdvantageDice) : 6 + const advantageFaces = data.rules?.roll?.advantageFaces ? Number.parseInt(data.rules.roll.advantageFaces) : 6 this.advantageFaces = Number.isNaN(advantageFaces) ? 6 : advantageFaces; } @@ -137,11 +137,11 @@ export default class DualityRoll extends D20Roll { } this.terms[0] = new game.system.api.dice.diceTypes.HopeDie({ - faces: this.data.rules.dualityRoll?.defaultHopeDice ?? 12 + faces: this.data.rules.roll?.hopeFaces ?? 12 }); this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' }); this.terms[2] = new game.system.api.dice.diceTypes.FearDie({ - faces: this.data.rules.dualityRoll?.defaultFearDice ?? 12 + faces: this.data.rules.roll?.fearFaces ?? 12 }); } diff --git a/src/packs/adversaries/adversary_Demon_of_Despair_kE4dfhqmIQpNd44e.json b/src/packs/adversaries/adversary_Demon_of_Despair_kE4dfhqmIQpNd44e.json index e2f58709..1bd47b82 100644 --- a/src/packs/adversaries/adversary_Demon_of_Despair_kE4dfhqmIQpNd44e.json +++ b/src/packs/adversaries/adversary_Demon_of_Despair_kE4dfhqmIQpNd44e.json @@ -357,8 +357,8 @@ }, "changes": [ { - "key": "system.rules.dualityRoll.defaultHopeDice", - "value": "d8", + "key": "system.rules.roll.hope", + "value": 2, "priority": null, "type": "override" } diff --git a/src/packs/adversaries/adversary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json b/src/packs/adversaries/adversary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json index 201b17fd..6e32e6bb 100644 --- a/src/packs/adversaries/adversary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json +++ b/src/packs/adversaries/adversary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json @@ -320,8 +320,8 @@ }, "changes": [ { - "key": "system.rules.dualityRoll.defaultFearDice", - "value": "d20", + "key": "system.rules.roll.fear", + "value": 5, "priority": null, "type": "override" } diff --git a/src/packs/environments/environment_Cult_Ritual_QAXXiOKBDmCTauHD.json b/src/packs/environments/environment_Cult_Ritual_QAXXiOKBDmCTauHD.json index 1295db59..ceb78083 100644 --- a/src/packs/environments/environment_Cult_Ritual_QAXXiOKBDmCTauHD.json +++ b/src/packs/environments/environment_Cult_Ritual_QAXXiOKBDmCTauHD.json @@ -192,9 +192,9 @@ }, "changes": [ { - "key": "system.rules.dualityRoll.defaultHopeDice", + "key": "system.rules.roll.hope", "mode": 5, - "value": "d10", + "value": 3, "priority": null } ],