diff --git a/module/rdd-combat.js b/module/rdd-combat.js index e1808d6a..6e313123 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -9,6 +9,7 @@ import { RdDRoll } from "./rdd-roll.js"; import { RdDRollTables } from "./rdd-rolltables.js"; import { ReglesOptionelles } from "./regles-optionelles.js"; +/* -------------------------------------------- */ export class RdDCombat { static init() { diff --git a/module/rdd-main.js b/module/rdd-main.js index aa5c25b5..aab4d527 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -97,6 +97,8 @@ const _patch_initiative = () => { messageOptions ); roll.toMessage(messageData, { rollMode, create: true }); + + RdDUtility.processPremierRoundInit( ); } return this; }; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 868ee8d4..aecf6742 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -63,6 +63,26 @@ const tableCaracDerivee = { 32: { xp: 180, poids: "1501-2000", plusdom:+11, sconst: 10, sust: 17 } } + /* -------------------------------------------- */ + const premierRoundInit = [ + { type: 'competence', pattern: 'hast', init: 3.90}, + { type: 'competence', pattern: 'lance', init: 3.85}, + { type: 'arme', pattern: 'bâton', init: 3.80}, + { type: 'arme', pattern: 'double dragonne', init: 3.75}, + { type: 'arme', pattern: 'esparlongue', init: 3.70}, + { type: 'arme', pattern: 'pée dragonne', init: 3.65}, + { type: 'arme', pattern: 'bâtarde', init: 3.60}, + { type: 'arme', pattern: 'cyane', init: 3.55}, + { type: 'arme', pattern: 'sorde', init: 3.50}, + { type: 'arme', pattern: 'grande hache', init: 3.45}, + { type: 'arme', pattern: 'bataille', init: 3.40}, + { type: 'arme', pattern: 'gnome', init: 3.35}, + { type: 'arme', pattern: 'masse', init: 3.30}, + { type: 'arme', pattern: 'gourdin', init: 3.25}, + { type: 'competence', pattern: 'fléau', init: 3.20}, + { type: 'arme', pattern: 'dague', init: 3.15}, + ]; + /* -------------------------------------------- */ function _buildAllSegmentsFatigue(max) { const cycle = [5, 2, 4, 1, 3, 0]; @@ -665,6 +685,37 @@ export class RdDUtility { } } + /* -------------------------------------------- */ + static processPremierRoundInit() { + // Check if we have the whole init ! + if ( game.user.isGM) { + let initDone = true; + for( let combatant of game.combat.data.combatants) { + if ( !combatant.initiative ) initDone = false; + } + if (initDone && game.combat.current.round == 1) { // Premier round ! + for( let combatant of game.combat.data.combatants) { + let arme = combatant.initiativeData.arme; + //console.log("Parsed !!!", combatant, initDone, game.combat.current, arme); + if ( arme && arme.type == "arme" ) { + for (let initData of premierRoundInit) { + if ( ( initData == 'competence' && arme.data.competence.toLowerCase().includes(initData.pattern)) || + (arme.name.toLowerCase().includes(initData.pattern)) ) { + let msg = `