From 0cb0a2f3ea8ef23a072ce79d10b282dca96f250d Mon Sep 17 00:00:00 2001 From: Vlyan Date: Mon, 8 Feb 2021 19:19:15 +0100 Subject: [PATCH] Save and display initialFormula on chat --- system/scripts/dice/roll.js | 6 ++++++ system/templates/dice/chat-roll.html | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/system/scripts/dice/roll.js b/system/scripts/dice/roll.js index fc0302b..8361f11 100644 --- a/system/scripts/dice/roll.js +++ b/system/scripts/dice/roll.js @@ -19,6 +19,7 @@ export class RollL5r5e extends Roll { keepLimit: null, isInitiativeRoll: false, skillAssistance: 0, + initialFormula: null, dicesTypes: { std: false, l5r: false, @@ -72,6 +73,11 @@ export class RollL5r5e extends Roll { super.evaluate({ minimize, maximize }); this._rolled = true; + // Save initial formula + if (!this.l5r5e.initialFormula) { + this.l5r5e.initialFormula = this.formula; + } + // Compute summary this.l5rSummary(); diff --git a/system/templates/dice/chat-roll.html b/system/templates/dice/chat-roll.html index 2fa2b1e..8807ce9 100644 --- a/system/templates/dice/chat-roll.html +++ b/system/templates/dice/chat-roll.html @@ -34,7 +34,7 @@ {{/if}} -
{{formula}}
+
{{#if l5r5e.initialFormula}}{{l5r5e.initialFormula}}{{else}}{{formula}}{{/if}}
{{#if l5r5e.dicesTypes.l5r}}