#20 Gestion des RollModes et gestion initiative plus fine

This commit is contained in:
sladecraven 2020-11-24 17:47:35 +01:00
parent 2cbd496517
commit ba66f79f63
2 changed files with 22 additions and 21 deletions

View File

@ -670,30 +670,30 @@ export class RdDUtility {
const combatant = game.combat.getCombatant(combatantId); const combatant = game.combat.getCombatant(combatantId);
const actor = combatant.actor; const actor = combatant.actor;
let initOffset = 0; if ( arme.name == "Autre action") {
let caracForInit = 0; game.combat.rollInitiative(combatantId, "1d6" );
let competence = RdDUtility.findCompetence( combatant.actor.data.items, arme.data.competence); } else if ( arme.name == "Draconic") {
game.combat.rollInitiative(combatantId, "1d6+200" );
if ( actor.data.type == 'creature' || actor.data.type == 'entite') {
caracForInit = competence.data.carac_value;
} else { } else {
if (arme.name == "Draconic") { let initOffset = 0;
initOffset = 200; let caracForInit = 0;
competence = { name: "Draconic", data : { niveau: 0 } }; // Fake 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 { } else {
caracForInit = actor.data.data.carac[competence.data.defaut_carac].value; caracForInit = actor.data.data.carac[competence.data.defaut_carac].value;
if (competence.data.categorie == "lancer" ) { // Offset de principe pour les armes de jet if (competence.data.categorie == "lancer" ) { // Offset de principe pour les armes de jet
initOffset = 40; initOffset = 40;
} }
if (competence.data.categorie == "tir" ) { // Offset de principe pour les armes de jet if (competence.data.categorie == "tir" ) { // Offset de principe pour les armes de jet
initOffset = 80; 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: "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: "Draconic", data: { competence: "Draconic" } } );
} }
armesList.push( { name: "Autre action", data: { competence: "Autre action" } } );
// Build the relevant submenu // Build the relevant submenu
if ( armesList ) { if ( armesList ) {
let menuItems = []; let menuItems = [];

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "0.9.83", "version": "0.9.84",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6", "compatibleCoreVersion": "0.7.6",
"templateVersion": 48, "templateVersion": 48,