From 155990610a4028e8c9f18a9a046af32732c485c8 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 17 Feb 2021 14:52:50 +0100 Subject: [PATCH] =?UTF-8?q?#158=20:=20Gestion=20de=20l'armure=20sur=20la?= =?UTF-8?q?=20fen=C3=AAtre=20d'encaissement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 11 +++++++++-- module/rdd-roll-encaisser.js | 5 +++++ templates/dialog-roll-encaisser.html | 23 ++++++++++++++--------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/module/actor.js b/module/actor.js index 37025a88..0abf2717 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2581,14 +2581,21 @@ export class RdDActor extends Actor { dmg = 0; } } - // TODO: max armure sur chutes... const penetration = arme ? Misc.toInt(arme.data.penetration) : 0; protection = Math.max(protection - penetration, 0); protection += this.getProtectionNaturelle(); - console.log("Final protect", protection); + // Gestion des cas particuliers sur la fenĂȘtre d'encaissement + if ( attackerRoll.dmg.encaisserSpecial && attackerRoll.dmg.encaisserSpecial == "noarmure") { + protection = 0; + } + if ( attackerRoll.dmg.encaisserSpecial && attackerRoll.dmg.encaisserSpecial == "chute" && Number(protection) > 2) { + protection = 2; + } + console.log("Final protect", protection, attackerRoll); return protection; } + /* -------------------------------------------- */ _deteriorerArmure(item, dmg) { if (!ReglesOptionelles.isUsing('deteriorationArmure')) { return; diff --git a/module/rdd-roll-encaisser.js b/module/rdd-roll-encaisser.js index 3b7d8ddb..5dca7b5c 100644 --- a/module/rdd-roll-encaisser.js +++ b/module/rdd-roll-encaisser.js @@ -29,6 +29,7 @@ export class RdDEncaisser extends Dialog { this.actor = actor; this.modifier = 0; + this.encaisserSpecial = "aucun"; } /* -------------------------------------------- */ @@ -36,6 +37,7 @@ export class RdDEncaisser extends Dialog { this.actor.encaisserDommages({ dmg:{ total: Number(this.modifier), + encaisserSpecial: this.encaisserSpecial, loc: { result: 0, label: "Corps" }, mortalite: mortalite } @@ -54,6 +56,9 @@ export class RdDEncaisser extends Dialog { html.find('#modificateurDegats').change((event) => { this.modifier = event.currentTarget.value; // Update the selected bonus/malus }); + html.find('#encaisserSpecial').change((event) => { + this.encaisserSpecial = event.currentTarget.value; // Update the selected bonus/malus + }); } } diff --git a/templates/dialog-roll-encaisser.html b/templates/dialog-roll-encaisser.html index bfb388e1..73244852 100644 --- a/templates/dialog-roll-encaisser.html +++ b/templates/dialog-roll-encaisser.html @@ -1,16 +1,21 @@
-

-
- - {{#select modificateurDegats}} {{#each ajustementsEncaissement as |key|}} {{/each}} {{/select}} - -
+ + +
+ + +
- -