Fix encaissement

- Amélioration du message d'encaissement (suppressions d'espaces en
excédent)
- Encaissement "cauchemar" réservé aux entités et inversement
This commit is contained in:
Vincent Vandemeulebrouck 2021-03-30 22:27:30 +02:00
parent 5e654bdfa4
commit ee34fad8b1
2 changed files with 27 additions and 15 deletions

View File

@ -7,17 +7,23 @@ export class RdDEncaisser extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
constructor(html, actor) { constructor(html, actor) {
// Common conf // 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 = { let dialogConf = {
title: "Jet d'Encaissement", title: "Jet d'Encaissement",
content: html, content: html,
buttons: { buttons: 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") }
},
default: "coupMortel" default: "coupMortel"
} }
let dialogOptions = { let dialogOptions = {
classes: ["rdddialog"], classes: ["rdddialog"],
width: 320, width: 320,
@ -32,13 +38,15 @@ export class RdDEncaisser extends Dialog {
this.encaisserSpecial = "aucun"; this.encaisserSpecial = "aucun";
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
performEncaisser(html, mortalite = "mortel") { performEncaisser(mortalite) {
this.actor.encaisserDommages({ this.actor.encaisserDommages({
dmg: { dmg: {
total: Number(this.modifier), total: Number(this.modifier),
encaisserSpecial: this.encaisserSpecial, encaisserSpecial: this.encaisserSpecial,
loc: { result: 0, label: "Corps" }, loc: { result: 0, label: "" },
mortalite: mortalite mortalite: mortalite
} }
}); });

View File

@ -17,9 +17,9 @@
</h4> </h4>
<div> <div>
Je d'encaissement de {{roll.total}} 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 (eq armure 0)}}, l'armure a protègé de {{armure}}
{{/unless}} {{~#unless (eq penetration 0)}} (pénétration de {{penetration}}){{/unless}}
{{/unless}}, total: <span class="rdd-roll-echec">{{total}}</span> {{~/unless}}, total: <span class="rdd-roll-echec">{{total}}</span>
<br> <br>
{{alias}} {{alias}}
{{#if (eq dmg.mortalite 'cauchemar')}}subit le coup {{#if (eq dmg.mortalite 'cauchemar')}}subit le coup
@ -29,10 +29,14 @@
{{else if critiques}}subit une blessure critique {{else if critiques}}subit une blessure critique
{{else if mort}}vient de mourir {{else if mort}}vient de mourir
{{else}}s'en sort sans une égratignure {{else}}s'en sort sans une égratignure
{{~/if~}}
{{~#unless (eq dmg.mortalite 'cauchemar')}}
{{#if dmg.loc.label}}
{{#if (gt roll.total 0)}}({{dmg.loc.label}}){{/if}}
{{/if}} {{/if}}
({{dmg.loc.label}}) {{/unless~}}
{{#if (gt endurance 0)}} {{~#if (gt endurance 0)}}
{{#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance {{~#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance
{{#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}} {{#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
{{/if}} {{/if}}
{{#if (ne dmg.mortalite 'cauchemar')}} {{#if (ne dmg.mortalite 'cauchemar')}}