From 449ec40f0746793e6cf3f4e626c46ca81ec2d538 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Fri, 29 Jan 2021 21:14:35 +0100 Subject: [PATCH] =?UTF-8?q?Gestion=20=C3=A9caille=20sur=20initiative?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-main.js | 3 ++- module/rdd-utility.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/module/rdd-main.js b/module/rdd-main.js index cb47fd2e..761d6f85 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -70,7 +70,8 @@ const _patch_initiative = () => { } let compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.data.competence; competence = RdDItemCompetence.findCompetence(c.actor.data.items, compName); - rollFormula = "2+( ("+RdDUtility.calculInitiative(competence.data.niveau, c.actor.data.data.carac[competence.data.defaut_carac].value) + ")/100)"; + let bonusEcaille = (armeCombat && armeCombat.data.magique) ? armeCombat.data.ecaille_efficacite : 0; + rollFormula = "2+( ("+RdDUtility.calculInitiative(competence.data.niveau, c.actor.data.data.carac[competence.data.defaut_carac].value, bonusEcaille) + ")/100)"; } } //console.log("Combatat", c); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 42940840..5062a405 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -457,8 +457,9 @@ export class RdDUtility { } /* -------------------------------------------- */ - static calculInitiative(niveau, caracValue) { + static calculInitiative(niveau, caracValue, bonusEcaille = 0) { let base = niveau + Math.floor(caracValue / 2); + base += bonusEcaille; return "1d6" + (base >= 0 ? "+" : "") + base; }