From 47eb508dd45d5e38f9cb0e4239f6502496f1ecbf Mon Sep 17 00:00:00 2001 From: Vlyan Date: Tue, 9 Feb 2021 14:01:43 +0100 Subject: [PATCH] Added Skill assistance used indicator --- system/lang/en-en.json | 1 + system/lang/es-es.json | 1 + system/lang/fr-fr.json | 1 + system/scripts/dice/roll-n-keep-dialog.js | 9 ++++++++- system/templates/dice/chat-roll.html | 6 +++++- system/templates/dice/roll-n-keep-dialog.html | 8 ++++++-- 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/system/lang/en-en.json b/system/lang/en-en.json index e9e83fd..6014268 100644 --- a/system/lang/en-en.json +++ b/system/lang/en-en.json @@ -87,6 +87,7 @@ "difficulty_hidden": "TN ???", "dicepicker": "Dice Picker", "void_point_used": "Void point used", + "assistance_used": "Skill assistance used", "roll_n_keep": "Roll & Keep", "initiative_roll": "Initiative roll", "success_text": "Success!", diff --git a/system/lang/es-es.json b/system/lang/es-es.json index a28748c..5c7ba77 100644 --- a/system/lang/es-es.json +++ b/system/lang/es-es.json @@ -87,6 +87,7 @@ "difficulty_hidden": "NO ???", "dicepicker": "Dice Picker", "void_point_used": "Punto de vacío utilizado", + "assistance_used": "Skill assistance used", "roll_n_keep": "Tirar y guardar", "initiative_roll": "Tirada de Iniciativa", "success_text": "Éxitos!", diff --git a/system/lang/fr-fr.json b/system/lang/fr-fr.json index 5cace65..3ad1c51 100644 --- a/system/lang/fr-fr.json +++ b/system/lang/fr-fr.json @@ -87,6 +87,7 @@ "difficulty_hidden": "ND ???", "dicepicker": "Dice Picker", "void_point_used": "Point de vide utilisé", + "assistance_used": "Assistance de compétence utilisée", "roll_n_keep": "Roll & Keep", "initiative_roll": "Jet d'initiative", "success_text": "Succès !", diff --git a/system/scripts/dice/roll-n-keep-dialog.js b/system/scripts/dice/roll-n-keep-dialog.js index 2ba7c3f..7bf1eca 100644 --- a/system/scripts/dice/roll-n-keep-dialog.js +++ b/system/scripts/dice/roll-n-keep-dialog.js @@ -211,10 +211,12 @@ export class RollnKeepDialog extends FormApplication { this.object.submitDisabled = kept < 1 || kept > this.roll.l5r5e.keepLimit; } else if (!this.object.dicesList[this.object.currentStep]) { this.options.editable = false; + this.options.classes.push("finalized"); } return { ...super.getData(options), + cssClass: this.options.classes.join(" "), data: this.object, l5r5e: this.message._roll.l5r5e, }; @@ -508,8 +510,13 @@ export class RollnKeepDialog extends FormApplication { async _rebuildRoll() { // Get all kept dices + new (choice null) const diceList = this.object.dicesList.reduce((acc, step, stepIdx) => { + const haveReroll = stepIdx > 0 && this._haveChoice(stepIdx - 1, RollnKeepDialog.CHOICES.reroll); step.forEach((die, idx) => { - if (!!die && [RollnKeepDialog.CHOICES.keep, RollnKeepDialog.CHOICES.nothing].includes(die.choice)) { + if ( + !!die && + (die.choice === RollnKeepDialog.CHOICES.keep || + (haveReroll && die.choice === RollnKeepDialog.CHOICES.nothing)) + ) { if (!acc[die.type]) { acc[die.type] = []; } diff --git a/system/templates/dice/chat-roll.html b/system/templates/dice/chat-roll.html index 8807ce9..d89c08a 100644 --- a/system/templates/dice/chat-roll.html +++ b/system/templates/dice/chat-roll.html @@ -26,8 +26,12 @@ {{else}} {{localize 'l5r5e.chatdices.difficulty'}} {{l5r5e.difficulty}} {{/if}} +
{{#if l5r5e.voidPointUsed}} -
+ + {{/if}} + {{#if l5r5e.skillAssistance}} + {{/if}} diff --git a/system/templates/dice/roll-n-keep-dialog.html b/system/templates/dice/roll-n-keep-dialog.html index 3ac5e00..7249647 100644 --- a/system/templates/dice/roll-n-keep-dialog.html +++ b/system/templates/dice/roll-n-keep-dialog.html @@ -1,4 +1,4 @@ -
+ {{!-- Profil --}}
@@ -30,8 +30,12 @@ {{else}} {{localize 'l5r5e.chatdices.difficulty'}} {{l5r5e.difficulty}} {{/if}} +
{{#if l5r5e.voidPointUsed}} -
+ + {{/if}} + {{#if l5r5e.skillAssistance}} + {{/if}}