#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 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 = [];

View File

@ -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,