diff --git a/lang/en.json b/lang/en.json index 2feaabb5..e4f60bc0 100755 --- a/lang/en.json +++ b/lang/en.json @@ -2170,6 +2170,7 @@ "rollWith": "{roll} Roll", "save": "Save", "scalable": "Scalable", + "scars": "Scars", "situationalBonus": "Situational Bonus", "spent": "Spent", "step": "Step", diff --git a/module/applications/dialogs/deathMove.mjs b/module/applications/dialogs/deathMove.mjs index ef41f096..ca00df82 100644 --- a/module/applications/dialogs/deathMove.mjs +++ b/module/applications/dialogs/deathMove.mjs @@ -1,4 +1,5 @@ import { enrichedFateRoll } from '../../enrichers/FateRollEnricher.mjs'; +import { enrichedDualityRoll } from '../../enrichers/DualityRollEnricher.mjs'; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; @@ -56,13 +57,67 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV if (config.roll.fate.value <= this.actor.system.levelData.level.current) { // apply scarring - for now directly apply - later add a button. console.log("Adding a scar...", this.actor.system.scars); - this.actor.system.scars.push({id:"1", name: "scar1", description: "description1"}); + const scar = { + [foundry.utils.randomID()]: { + name: "A scar " + this.actor.system.scars.length, + description: "A description" + } + } + console.log("scar", scar); + + console.log('something goes here to update the scars data...'); + + + await this.actor.update( + { + system: { + scars: { + scar + } + } + }, + { overwrite: true } + ); + + console.log("Adding a scar result", this.actor.system.scars); } } - handleRiskItAll() { + async handleRiskItAll() { console.log("Risk It All!"); + + const config = await enrichedDualityRoll({ + reaction: true, + traitValue: null, + target: null, + difficulty: null, + title: "Risk It All", + label: 'test', + actionType: null, + advantage: null + }); + + console.log("config", config); + + if (config.roll.isCritical) { + console.log("Clear all stress and HP"); + return; + } + + // Hope + if (config.roll.result.duality == 1) { + console.log("Need to clear up Stress and HP up to hope value"); + console.log("Hope rolled", config.roll.hope.value); + return; + } + + //Fear + if (config.roll.result.duality == -1) { + console.log("You have died..."); + return; + } + } static selectMove(_, button) { diff --git a/module/enrichers/DualityRollEnricher.mjs b/module/enrichers/DualityRollEnricher.mjs index 1d6404ff..b56984fc 100644 --- a/module/enrichers/DualityRollEnricher.mjs +++ b/module/enrichers/DualityRollEnricher.mjs @@ -105,4 +105,5 @@ export const enrichedDualityRoll = async ( config.source = { actor: null }; await CONFIG.Dice.daggerheart.DualityRoll.build(config); } + return config; }; diff --git a/templates/dialogs/dice-roll/rollSelection.hbs b/templates/dialogs/dice-roll/rollSelection.hbs index a4e95cc2..a0ad1e56 100644 --- a/templates/dialogs/dice-roll/rollSelection.hbs +++ b/templates/dialogs/dice-roll/rollSelection.hbs @@ -113,6 +113,7 @@ {{/if}}