From afe5ddcb8da68a80b9b6f073cb3ab9e22020a88c Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 17 Dec 2020 00:05:32 +0100 Subject: [PATCH] =?UTF-8?q?Masquer=20les=20d=C3=A9s=20d=C3=A9t=C3=A9riorat?= =?UTF-8?q?ion/recul?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 21 +++++++++++++++++---- module/rdd-calendrier.js | 6 ++++-- module/rdd-resolution-table.js | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/module/actor.js b/module/actor.js index c30866b2..ae0c8b85 100644 --- a/module/actor.js +++ b/module/actor.js @@ -182,7 +182,10 @@ export class RdDActor extends Actor { let resistance = Misc.toInt(rollData.arme.data.resistance); let msg = ""; // Jet de résistance de l'arme de parade (p.132) - let resistRoll = await RdDResolutionTable.roll( resistance, - dmg ); + let resistRoll = await RdDResolutionTable.rollData({ + caracValue: resistance, + finalLevel: - dmg, + showDice: false}); if (resistRoll.isSuccess) { // Perte de résistance msg = "Votre " + rollData.arme.name + " tient le choc de la parade. " } else { @@ -197,7 +200,10 @@ export class RdDActor extends Actor { } // Jet de désarmement if (resistance > 0 && !rollData.arme.name.toLowerCase().includes('bouclier') ) { // Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132) - let desarme = await RdDResolutionTable.roll( this.data.data.carac.force.value, Misc.toInt(rollData.competence.data.niveau) -dmg ); + let desarme = await RdDResolutionTable.rollData({ + caracValue: this.data.data.carac.force.value, + finalLevel: Misc.toInt(rollData.competence.data.niveau) - dmg, + showDice: false}); if ( desarme.isEchec) { msg += "Vous ne parvenez pas à garder votre arme en main, elle tombe au sol à vos pieds"; } @@ -214,12 +220,19 @@ export class RdDActor extends Actor { if ( rollData.arme || encaisser ) { if ( (rollData.attackerRoll.particuliereAttaque && rollData.attackerRoll.particuliereAttaque == 'force') || rollData.attackerRoll.tactique == 'charge') { let reculNiveau = Misc.toInt(this.data.data.carac.taille.value) - (rollData.attackerRoll.forceValue+rollData.attackerRoll.arme.data.dommagesReels); - let recul = await RdDResolutionTable.roll( 10, reculNiveau ); + let recul = await RdDResolutionTable.rollData({ + caracValue: 10, + finalLevel: reculNiveau, + showDice: false}); + let msg = ""; if (recul.isSuccess) { msg = " Vous ne reculez pas malgré la force du coup."; } else { - let chute = await RdDResolutionTable.roll( this.data.data.carac.agilite.value, reculNiveau ); + let chute = await RdDResolutionTable.rollData({ + caracValue: this.data.data.carac.agilite.value, + finalLevel: reculNiveau, + showDice: false}); if ( !chute.isSuccess || recul.isETotal ) { msg = "Sous la violence du coup, vous reculez et chutez au sol ! Vous ne pouvez plus attaquer ce round."; } else { diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index bc6d7eab..ee248b73 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -234,8 +234,10 @@ export class RdDCalendrier extends Application { console.log( request ); let jourDiff = this.getLectureAstrologieDifficulte( request.date); let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat); - let rolled = await RdDResolutionTable.roll(request.carac_vue, niveau, undefined, false); - + let rolled = await RdDResolutionTable.rollData({ + caracValue: request.carac_vue, + finalLevel: niveau, + showDice: false}); let nbAstral = this.getNombreAstral( request.date ); let nbAstralFaux = nbAstral; request.isValid = true; diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index 06cbe388..4109811e 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -91,7 +91,7 @@ export class RdDResolutionTable { /* -------------------------------------------- */ static async rollData(rollData) { - rollData.rolled = await this.roll(rollData.caracValue, rollData.finalLevel, rollData.bonus, rollData.needSignificative); + rollData.rolled = await this.roll(rollData.caracValue, rollData.finalLevel, rollData.bonus, rollData.needSignificative, !rollData.showDice); } /* -------------------------------------------- */