43 Init et attaque vie HUD ou fiche de perso

This commit is contained in:
2020-12-05 21:24:31 +01:00
parent 72b3a96354
commit be73c51b97
5 changed files with 95 additions and 41 deletions

View File

@ -403,19 +403,20 @@ export class RdDUtility {
/* -------------------------------------------- */
/** Retourne une liste triée d'armes avec le split arme1 main / arme 2 main */
static finalizeArmeList( armeList, competenceByCategory ) {
static finalizeArmeList( armeList, competenceList, carac ) {
// Gestion des armes 1/2 mains
let arme2mains = []; // Tableau contenant la duplication des armes 1m/2m
for (const arme of armeList) {
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);
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
if (arme.data.unemain && arme.data.deuxmains) {
let arme2main = duplicate(arme);
arme2main.data.dommages = arme2main.data.dommages.split("/")[1]; // Existence temporaire uniquement dans la liste des armes, donc OK
arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
for ( const melee of competenceByCategory.melee ) {
if (melee.name == arme2main.data.competence )
arme2main.data.niveau = melee.data.niveau
}
let comp = competenceList.find(c => c.name == arme2main.data.competence);
arme2main.data.niveau = comp.data.niveau;
arme2main.data.initiative = "1d6+" + arme2main.data.niveau + "+" + Math.ceil(carac[comp.data.defaut_carac].value/2);
arme2mains.push(arme2main);
}
}
@ -782,9 +783,9 @@ export class RdDUtility {
// Force corps à corps et Draconic
let cc = RdDUtility.findCompetence( combatant.actor.data.items, "Corps à corps");
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: { initOnly: true, competence: "Draconic" } } );
}
armesList.push( { name: "Autre action", data: { competence: "Autre action" } } );
armesList.push( { name: "Autre action", data: { initOnly: true, competence: "Autre action" } } );
return armesList;
}