From ba66f79f63a8e7ae965c0a161fe829b770bdf203 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 24 Nov 2020 17:47:35 +0100 Subject: [PATCH] #20 Gestion des RollModes et gestion initiative plus fine --- module/rdd-utility.js | 41 +++++++++++++++++++++-------------------- system.json | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 9ddad681..b8220346 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -670,30 +670,30 @@ export class RdDUtility { const combatant = game.combat.getCombatant(combatantId); const actor = combatant.actor; - let initOffset = 0; - let caracForInit = 0; - let competence = RdDUtility.findCompetence( combatant.actor.data.items, arme.data.competence); - - if ( actor.data.type == 'creature' || actor.data.type == 'entite') { - caracForInit = competence.data.carac_value; + if ( arme.name == "Autre action") { + game.combat.rollInitiative(combatantId, "1d6" ); + } else if ( arme.name == "Draconic") { + game.combat.rollInitiative(combatantId, "1d6+200" ); } else { - if (arme.name == "Draconic") { - initOffset = 200; - competence = { name: "Draconic", data : { niveau: 0 } }; // Fake + let initOffset = 0; + let caracForInit = 0; + let competence = RdDUtility.findCompetence( combatant.actor.data.items, arme.data.competence); + + if ( actor.data.type == 'creature' || actor.data.type == 'entite') { + caracForInit = competence.data.carac_value; } else { - caracForInit = actor.data.data.carac[competence.data.defaut_carac].value; - if (competence.data.categorie == "lancer" ) { // Offset de principe pour les armes de jet - initOffset = 40; - } - if (competence.data.categorie == "tir" ) { // Offset de principe pour les armes de jet - initOffset = 80; - } + caracForInit = actor.data.data.carac[competence.data.defaut_carac].value; + if (competence.data.categorie == "lancer" ) { // Offset de principe pour les armes de jet + initOffset = 40; + } + if (competence.data.categorie == "tir" ) { // Offset de principe pour les armes de jet + initOffset = 80; + } } + // Cas des créatures et entités vs personnages + let rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(caracForInit/2) + "+" + initOffset; + game.combat.rollInitiative(combatantId, rollFormula ); } - // Cas des créatures et entités vs personnages - let rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(caracForInit/2) + "+" + initOffset; - game.combat.rollInitiative(combatantId, rollFormula ); - console.log("Roll !", competence, arme, rollFormula ); } /* -------------------------------------------- */ @@ -719,6 +719,7 @@ export class RdDUtility { armesList.push( { name: "Corps à corps", data: { niveau: cc.data.niveau, description: "", force: 6, competence: "Corps à corps", dommages: combatant.actor.data.data.attributs.plusdom.value } } ); armesList.push( { name: "Draconic", data: { competence: "Draconic" } } ); } + armesList.push( { name: "Autre action", data: { competence: "Autre action" } } ); // Build the relevant submenu if ( armesList ) { let menuItems = []; diff --git a/system.json b/system.json index 0ccf74f4..c5ae549a 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "0.9.83", + "version": "0.9.84", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.6", "templateVersion": 48,