From 1f61c955b70c30384f9ff124810cf6d5ea3628ba Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 17 Feb 2021 15:16:56 +0100 Subject: [PATCH] #159 Affiche d'informations sur l'init --- module/rdd-main.js | 4 ++-- module/rdd-utility.js | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/module/rdd-main.js b/module/rdd-main.js index 2b6b990f..72dabf6d 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -39,7 +39,7 @@ const _patch_initiative = () => { Combat.prototype.rollInitiative = async function ( ids, formula = undefined, - messageOptions = {} + messageOptions = {} ) { console.log( `${game.data.system.data.title} | Combat.rollInitiative()`, @@ -94,7 +94,7 @@ const _patch_initiative = () => { alias: c.token.name, sound: CONFIG.sounds.dice, }, - flavor: `${c.token.name} a fait son jet d'Initiative`, + flavor: `${c.token.name} a fait son jet d'Initiative (${messageOptions.initInfo})`, }, messageOptions ); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 14069a3c..de605b65 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -723,21 +723,28 @@ export class RdDUtility { const combatant = game.combat.getCombatant(combatantId); const actor = combatant.actor; + let initInfo = ""; let initOffset = 0; let caracForInit = 0; let compNiveau = 0; + let competence = { name: "Aucune"}; if (actor.getSurprise() == "totale") { initOffset = -1; // To force 0 + initInfo = "Surprise Totale" } else if (actor.getSurprise() == "demi") { initOffset = 0; + initInfo = "Demi Surprise" } else if (arme.name == "Autre action") { initOffset = 2; + initInfo = "Autre Action" } else if (arme.name == "Draconic") { initOffset = 7; + initInfo = "Draconic" } else { initOffset = 3; // Melée = 3.XX - let competence = RdDItemCompetence.findCompetence(combatant.actor.data.items, arme.data.competence); + competence = RdDItemCompetence.findCompetence(combatant.actor.data.items, arme.data.competence); compNiveau = competence.data.niveau; + initInfo = arme.name + " / " + arme.data.competence; if (actor.data.type == 'creature' || actor.data.type == 'entite') { caracForInit = competence.data.carac_value; @@ -762,7 +769,7 @@ export class RdDUtility { let rollFormula = initOffset + "+ ( (" + RdDUtility.calculInitiative(compNiveau, caracForInit) + " + " + malus + ") /100)"; // Garder la trace de l'arme/compétence utilisée pour l'iniative combatant.initiativeData = { arme: arme } // pour reclasser l'init au round 0 - game.combat.rollInitiative(combatantId, rollFormula); + game.combat.rollInitiative(combatantId, rollFormula, { initInfo: initInfo}); } /* -------------------------------------------- */