Merge branch 'fix-init-ref-circulaire' into 'dev_1.1'
Fix init et ref circulaire See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!62
This commit is contained in:
commit
0eea44d2c5
@ -96,7 +96,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
if (melee.name == "Esquive")
|
if (melee.name == "Esquive")
|
||||||
data.data.combat.push( { name: "Esquive", data: { niveau: melee.data.niveau, description: "", force: 6, initiative: "-", competence: "Esquive", dommages: 0} } );
|
data.data.combat.push( { name: "Esquive", data: { niveau: melee.data.niveau, description: "", force: 6, initiative: "-", competence: "Esquive", dommages: 0} } );
|
||||||
if (melee.name == "Corps à corps") {
|
if (melee.name == "Corps à corps") {
|
||||||
let cc_init = "1d6" + melee.data.niveau + "+" + Math.ceil(data.data.carac['melee'].value / 2 );
|
let cc_init = RdDUtility.calculInitiative(melee.data.niveau, data.data.carac['melee'].value);
|
||||||
data.data.combat.push( { name: "Corps à corps", data: { niveau: melee.data.niveau, description: "", force: 6, initiative: cc_init, competence: "Corps à corps", dommages: data.data.attributs.plusdom.value } } );
|
data.data.combat.push( { name: "Corps à corps", data: { niveau: melee.data.niveau, description: "", force: 6, initiative: cc_init, competence: "Corps à corps", dommages: data.data.attributs.plusdom.value } } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async performRoll(rollData, attacker = undefined) {
|
async performRoll(rollData, attacker = undefined) {
|
||||||
// garder le résultat
|
// garder le résultat
|
||||||
rollData.rolled = await RdDResolutionTable.rollData(rollData);
|
await RdDResolutionTable.rollData(rollData);
|
||||||
|
|
||||||
//console.log("performRoll", rollData)
|
//console.log("performRoll", rollData)
|
||||||
if ( !rollData.attackerRoll) {// Store in the registry if not a defense roll
|
if ( !rollData.attackerRoll) {// Store in the registry if not a defense roll
|
||||||
|
@ -54,7 +54,7 @@ const _patch_initiative = () => {
|
|||||||
competence = duplicate(competenceItem);
|
competence = duplicate(competenceItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(competence.data.carac_value / 2);
|
rollFormula = RdDUtility.calculInitiative(competence.data.niveau, competence.data.carac_value);
|
||||||
} else {
|
} else {
|
||||||
for (const item of c.actor.data.items) {
|
for (const item of c.actor.data.items) {
|
||||||
if (item.type == "arme" && item.data.equipe) {
|
if (item.type == "arme" && item.data.equipe) {
|
||||||
@ -63,7 +63,7 @@ const _patch_initiative = () => {
|
|||||||
}
|
}
|
||||||
let compName = ( armeCombat == undefined ) ? "Corps à corps" : armeCombat.data.competence;
|
let compName = ( armeCombat == undefined ) ? "Corps à corps" : armeCombat.data.competence;
|
||||||
competence = RdDUtility.findCompetence( c.actor.data.items, compName );
|
competence = RdDUtility.findCompetence( c.actor.data.items, compName );
|
||||||
rollFormula = "1d6+" + competence.data.niveau + "+" + Math.ceil(c.actor.data.data.carac[competence.data.defaut_carac].value/2);
|
rollFormula = RdDUtility.calculInitiative(competence.data.niveau, c.actor.data.data.carac[competence.data.defaut_carac].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log("Combatat", c);
|
//console.log("Combatat", c);
|
||||||
|
@ -100,7 +100,6 @@ export class RdDResolutionTable {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async rollData(rollData ) {
|
static async rollData(rollData ) {
|
||||||
rollData.rolled = await this.roll(rollData.caracValue, rollData.finalLevel, rollData.bonus);
|
rollData.rolled = await this.roll(rollData.caracValue, rollData.finalLevel, rollData.bonus);
|
||||||
return rollData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import { TMRUtility } from "./tmr-utility.js";
|
import { TMRUtility } from "./tmr-utility.js";
|
||||||
import { RdDRollTables } from "./rdd-rolltables.js";
|
import { RdDRollTables } from "./rdd-rolltables.js";
|
||||||
import { ChatUtility } from "./chat-utility.js";
|
import { ChatUtility } from "./chat-utility.js";
|
||||||
|
import { Misc } from "./misc.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
const level_category = {
|
const level_category = {
|
||||||
@ -425,7 +426,7 @@ export class RdDUtility {
|
|||||||
let arme2mains = []; // Tableau contenant la duplication des armes 1m/2m
|
let arme2mains = []; // Tableau contenant la duplication des armes 1m/2m
|
||||||
for (const arme of armeList) {
|
for (const arme of armeList) {
|
||||||
let comp = competenceList.find(c => c.name == arme.data.competence);
|
let comp = competenceList.find(c => c.name == arme.data.competence);
|
||||||
arme.data.initiative = "1d6+" + arme.data.niveau + "+" + Math.ceil(carac[comp.data.defaut_carac].value/2);
|
arme.data.initiative = RdDUtility.calculInitiative(arme.data.niveau, carac[comp.data.defaut_carac].value);
|
||||||
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
||||||
if (arme.data.unemain && arme.data.deuxmains) {
|
if (arme.data.unemain && arme.data.deuxmains) {
|
||||||
let arme2main = duplicate(arme);
|
let arme2main = duplicate(arme);
|
||||||
@ -433,7 +434,7 @@ export class RdDUtility {
|
|||||||
arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
|
arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
|
||||||
let comp = competenceList.find(c => c.name == arme2main.data.competence);
|
let comp = competenceList.find(c => c.name == arme2main.data.competence);
|
||||||
arme2main.data.niveau = comp.data.niveau;
|
arme2main.data.niveau = comp.data.niveau;
|
||||||
arme2main.data.initiative = "1d6+" + arme2main.data.niveau + "+" + Math.ceil(carac[comp.data.defaut_carac].value/2);
|
arme2main.data.initiative = RdDUtility.calculInitiative(arme2main.data.niveau, carac[comp.data.defaut_carac].value);
|
||||||
arme2mains.push(arme2main);
|
arme2mains.push(arme2main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -442,6 +443,11 @@ export class RdDUtility {
|
|||||||
return armeList
|
return armeList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static calculInitiative(niveau, caracValue) {
|
||||||
|
let base = niveau + Math.floor(caracValue/2);
|
||||||
|
return "1d6" + (base >= 0 ? "+" : "") + base;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static computeCarac( data)
|
static computeCarac( data)
|
||||||
{
|
{
|
||||||
@ -786,7 +792,7 @@ export class RdDUtility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 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 = RdDUtility.calculInitiative(competence.data.niveau, caracForInit) + "+" + initOffset;
|
||||||
game.combat.rollInitiative(combatantId, rollFormula );
|
game.combat.rollInitiative(combatantId, rollFormula );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user