#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,16 +670,17 @@ export class RdDUtility {
const combatant = game.combat.getCombatant(combatantId); const combatant = game.combat.getCombatant(combatantId);
const actor = combatant.actor; const actor = combatant.actor;
if ( arme.name == "Autre action") {
game.combat.rollInitiative(combatantId, "1d6" );
} else if ( arme.name == "Draconic") {
game.combat.rollInitiative(combatantId, "1d6+200" );
} else {
let initOffset = 0; let initOffset = 0;
let caracForInit = 0; let caracForInit = 0;
let competence = RdDUtility.findCompetence( combatant.actor.data.items, arme.data.competence); let competence = RdDUtility.findCompetence( combatant.actor.data.items, arme.data.competence);
if ( actor.data.type == 'creature' || actor.data.type == 'entite') { if ( actor.data.type == 'creature' || actor.data.type == 'entite') {
caracForInit = competence.data.carac_value; caracForInit = competence.data.carac_value;
} else {
if (arme.name == "Draconic") {
initOffset = 200;
competence = { name: "Draconic", data : { niveau: 0 } }; // Fake
} 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
@ -689,11 +690,10 @@ export class RdDUtility {
initOffset = 80; initOffset = 80;
} }
} }
}
// Cas des créatures et entités vs personnages // Cas des créatures et entités vs personnages
let rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(caracForInit/2) + "+" + initOffset; let rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(caracForInit/2) + "+" + initOffset;
game.combat.rollInitiative(combatantId, rollFormula ); 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,