From 3c9ef75645ef840c2465c43dd878a0ebe0b45d6d Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Tue, 13 Jan 2026 10:58:03 +0100 Subject: [PATCH] [Feature] ActiveEffect Default Hope/Fear dice (#1522) * Added ActiveEffect rules for default hope and fear dice * . * Raised system version --- lang/en.json | 2 + .../applications/sheets/actors/character.mjs | 1 + module/config/generalConfig.mjs | 2 + module/data/actor/character.mjs | 18 +++++ module/dice/dualityRoll.mjs | 7 +- ...ary_Demon_of_Despair_kE4dfhqmIQpNd44e.json | 11 ++- ...rsary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json | 73 ++++++++++++++--- ...ironment_Cult_Ritual_QAXXiOKBDmCTauHD.json | 80 ++++++++++++++++++- system.json | 2 +- 9 files changed, 180 insertions(+), 16 deletions(-) diff --git a/lang/en.json b/lang/en.json index 66955580..b84906f3 100755 --- a/lang/en.json +++ b/lang/en.json @@ -203,6 +203,8 @@ "unequip": "Unequip", "useItem": "Use Item" }, + "defaultHopeDice": "Default Hope Dice", + "defaultFearDice": "Default Fear Dice", "disadvantageSources": { "label": "Disadvantage Sources", "hint": "Add single words or short text as reminders and hints of what a character has disadvantage on." 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 eba46f10..f6ab7e3a 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -280,6 +280,24 @@ export default class DhCharacter extends BaseDataActor { }) }) }), + 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' + }) + }), runeWard: new fields.BooleanField({ initial: false }), burden: new fields.SchemaField({ ignore: new fields.BooleanField() diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index d035a61c..155d6aa5 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -130,9 +130,12 @@ export default class DualityRoll extends D20Roll { this.terms = [this.terms[0], this.terms[1], this.terms[2]]; return; } - this.terms[0] = new foundry.dice.terms.Die({ faces: 12 }); + + const { defaultHopeDice, defaultFearDice } = this.data.rules.dualityRoll; + + 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: 12 }); + this.terms[2] = new foundry.dice.terms.Die({ faces: defaultFearDice }); } applyAdvantage() { diff --git a/src/packs/adversaries/adversary_Demon_of_Despair_kE4dfhqmIQpNd44e.json b/src/packs/adversaries/adversary_Demon_of_Despair_kE4dfhqmIQpNd44e.json index b1804074..188b2687 100644 --- a/src/packs/adversaries/adversary_Demon_of_Despair_kE4dfhqmIQpNd44e.json +++ b/src/packs/adversaries/adversary_Demon_of_Despair_kE4dfhqmIQpNd44e.json @@ -312,7 +312,14 @@ "range": "melee" } }, - "changes": [], + "changes": [ + { + "key": "system.rules.dualityRoll.defaultHopeDice", + "mode": 5, + "value": "d8", + "priority": null + } + ], "disabled": false, "duration": { "startTime": null, @@ -323,7 +330,7 @@ "startRound": null, "startTurn": null }, - "description": "
All targets aff ected replace their Hope Die with a d8 until they roll a success with Hope or their next rest.
", + "description": "All targets affected replace their Hope Die with a d8 until they roll a success with Hope or their next rest.
", "tint": "#ffffff", "statuses": [], "sort": 0, diff --git a/src/packs/adversaries/adversary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json b/src/packs/adversaries/adversary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json index 800e7305..2341ee8a 100644 --- a/src/packs/adversaries/adversary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json +++ b/src/packs/adversaries/adversary_Demon_of_Wrath_5lphJAgzoqZI3VoG.json @@ -256,34 +256,45 @@ "description": "Spend a Fear to boil the blood of all PCs within Far range. They use a d20 as their Fear Die until the end of the scene.
@Template[type:emanation|range:f]
", "resource": null, "actions": { - "V142qYppCGJn8OiN": { + "jKvzbQT0vp66DDOH": { "type": "effect", - "_id": "V142qYppCGJn8OiN", + "_id": "jKvzbQT0vp66DDOH", "systemPath": "actions", + "baseAction": false, "description": "", "chatDisplay": true, + "originItem": { + "type": "itemCollection" + }, "actionType": "action", "cost": [ { "scalable": false, "key": "fear", "value": 1, - "step": null + "itemId": null, + "step": null, + "consumeOnSuccess": false } ], "uses": { "value": null, "max": "", - "recovery": null + "recovery": null, + "consumeOnSuccess": false }, - "effects": [], + "effects": [ + { + "_id": "gFeHLGgeRoDdd3VG", + "onSave": false + } + ], "target": { - "type": "self", + "type": "hostile", "amount": null }, "name": "Spend Fear", - "img": "icons/skills/melee/maneuver-greatsword-yellow.webp", - "range": "" + "range": "far" } }, "originItemType": null, @@ -292,7 +303,51 @@ }, "_id": "a33PW8UkziliowlR", "img": "icons/skills/melee/maneuver-greatsword-yellow.webp", - "effects": [], + "effects": [ + { + "name": "Battle Lust", + "img": "icons/skills/melee/maneuver-greatsword-yellow.webp", + "origin": "Compendium.daggerheart.adversaries.Actor.5lphJAgzoqZI3VoG.Item.a33PW8UkziliowlR", + "transfer": false, + "_id": "gFeHLGgeRoDdd3VG", + "type": "base", + "system": { + "rangeDependence": { + "enabled": false, + "type": "withinRange", + "target": "hostile", + "range": "melee" + } + }, + "changes": [ + { + "key": "system.rules.dualityRoll.defaultFearDice", + "mode": 5, + "value": "d20", + "priority": null + } + ], + "disabled": false, + "duration": { + "startTime": null, + "combat": null, + "seconds": null, + "rounds": null, + "turns": null, + "startRound": null, + "startTurn": null + }, + "description": "You use a d20 as your Fear Die until the end of the scene.
", + "tint": "#ffffff", + "statuses": [], + "sort": 0, + "flags": {}, + "_stats": { + "compendiumSource": null + }, + "_key": "!actors.items.effects!5lphJAgzoqZI3VoG.a33PW8UkziliowlR.gFeHLGgeRoDdd3VG" + } + ], "folder": null, "sort": 0, "ownership": { diff --git a/src/packs/environments/environment_Cult_Ritual_QAXXiOKBDmCTauHD.json b/src/packs/environments/environment_Cult_Ritual_QAXXiOKBDmCTauHD.json index 66931f0a..1295db59 100644 --- a/src/packs/environments/environment_Cult_Ritual_QAXXiOKBDmCTauHD.json +++ b/src/packs/environments/environment_Cult_Ritual_QAXXiOKBDmCTauHD.json @@ -136,13 +136,89 @@ "system": { "description": "Cultists dedicated this place to the Fallen Gods, and their foul influence seeps into it. Reduce the PCs’ Hope Die to a d10 while in this environment. The desecration can be removed with a Progress Countdown (6).
How do the PCs fist notice that something is wrong about this place? What fears resurface while hope is kept at bay?
Your Hope Die is reduced to a d10 while in the Desecrated Grounds.
", + "tint": "#ffffff", + "statuses": [], + "sort": 0, + "flags": {}, + "_stats": { + "compendiumSource": null + }, + "_key": "!actors.items.effects!QAXXiOKBDmCTauHD.iiHjguQG2aBn9g8i.8yNIw8Y7rfMdOqWC" + } + ], "folder": null, "sort": 0, "ownership": { diff --git a/system.json b/system.json index 5570bdbf..43f82f06 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "daggerheart", "title": "Daggerheart", "description": "An unofficial implementation of the Daggerheart system", - "version": "1.4.6", + "version": "1.5.0", "compatibility": { "minimum": "13.346", "verified": "13.351",