#159 Affiche d'informations sur l'init

This commit is contained in:
sladecraven 2021-02-17 15:16:56 +01:00
parent 155990610a
commit 1f61c955b7
2 changed files with 11 additions and 4 deletions

View File

@ -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
);

View File

@ -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});
}
/* -------------------------------------------- */