diff --git a/module/rdd-roll-encaisser.js b/module/rdd-roll-encaisser.js index 5dca7b5c..a8e0d6e5 100644 --- a/module/rdd-roll-encaisser.js +++ b/module/rdd-roll-encaisser.js @@ -7,17 +7,23 @@ export class RdDEncaisser extends Dialog { /* -------------------------------------------- */ constructor(html, actor) { // Common conf + const buttonsCreatures = { + "mortel": { label: "mortel", callback: html => this.performEncaisser("mortel") }, + "non-mortel": { label: "non-mortel", callback: html => this.performEncaisser("non-mortel") }, + }; + const buttonsEntitesCauchemar = { + "cauchemar": { label: "cauchemar", callback: html => this.performEncaisser("cauchemar") } + }; + const buttons = actor.isEntiteCauchemar() ? buttonsEntitesCauchemar : buttonsCreatures; + let dialogConf = { title: "Jet d'Encaissement", content: html, - buttons: { - "mortel": { label: "mortel", callback: html => this.performEncaisser(html, "mortel") }, - "non-mortel": { label: "non-mortel", callback: html => this.performEncaisser(html, "non-mortel") }, - "cauchemar": { label: "cauchemar", callback: html => this.performEncaisser(html, "cauchemar") } - }, + buttons: buttons, default: "coupMortel" } + let dialogOptions = { classes: ["rdddialog"], width: 320, @@ -32,13 +38,15 @@ export class RdDEncaisser extends Dialog { this.encaisserSpecial = "aucun"; } + + /* -------------------------------------------- */ - performEncaisser(html, mortalite = "mortel") { + performEncaisser(mortalite) { this.actor.encaisserDommages({ - dmg:{ + dmg: { total: Number(this.modifier), encaisserSpecial: this.encaisserSpecial, - loc: { result: 0, label: "Corps" }, + loc: { result: 0, label: "" }, mortalite: mortalite } }); diff --git a/templates/chat-resultat-encaissement.html b/templates/chat-resultat-encaissement.html index 8e1621f6..6d80ae34 100644 --- a/templates/chat-resultat-encaissement.html +++ b/templates/chat-resultat-encaissement.html @@ -17,9 +17,9 @@
Je d'encaissement de {{roll.total}} - {{#unless (eq armure 0)}}, l'armure a protègé de {{armure}} {{#unless (eq penetration 0)}}(pénétration de {{penetration}}) - {{/unless}} - {{/unless}}, total: {{total}} + {{#unless (eq armure 0)}}, l'armure a protègé de {{armure}} + {{~#unless (eq penetration 0)}} (pénétration de {{penetration}}){{/unless}} + {{~/unless}}, total: {{total}}
{{alias}} {{#if (eq dmg.mortalite 'cauchemar')}}subit le coup @@ -29,10 +29,14 @@ {{else if critiques}}subit une blessure critique {{else if mort}}vient de mourir {{else}}s'en sort sans une égratignure - {{/if}} - ({{dmg.loc.label}}) - {{#if (gt endurance 0)}} - {{#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance + {{~/if~}} + {{~#unless (eq dmg.mortalite 'cauchemar')}} + {{#if dmg.loc.label}} + {{#if (gt roll.total 0)}}({{dmg.loc.label}}){{/if}} + {{/if}} + {{/unless~}} + {{~#if (gt endurance 0)}} + {{~#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance {{#if (ne vie 0)}}, {{vie}} points de vie{{/if}} {{/if}} {{#if (ne dmg.mortalite 'cauchemar')}}