#38 - Gestion des armes 1/2mains
This commit is contained in:
parent
1c2a60017d
commit
11bca6fc23
@ -62,7 +62,6 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
// Force empty arme, at least for Esquive
|
||||
if (data.itemsByType.arme == undefined ) data.itemsByType.arme = [];
|
||||
let arme2mains = []; // tablea contenant la duplication des armes 1m/2m
|
||||
for (const arme of data.itemsByType.arme) {
|
||||
arme.data.niveau = 0; // Per default, TODO to be fixed
|
||||
for ( const melee of data.competenceByCategory.melee ) {
|
||||
@ -77,6 +76,13 @@ export class RdDActorSheet extends ActorSheet {
|
||||
if (lancer.name == arme.data.competence )
|
||||
arme.data.niveau = lancer.data.niveau
|
||||
}
|
||||
}
|
||||
|
||||
// To avoid armour and so on...
|
||||
data.data.combat = duplicate( RdDUtility.checkNull(data.itemsByType['arme']));
|
||||
// Gestion des armes 1/2 mains
|
||||
let arme2mains = []; // Tableau contenant la duplication des armes 1m/2m
|
||||
for (const arme of data.data.combat) {
|
||||
// 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);
|
||||
@ -88,10 +94,8 @@ export class RdDActorSheet extends ActorSheet {
|
||||
arme2mains.push(arme2main);
|
||||
}
|
||||
}
|
||||
data.itemsByType.arme = data.itemsByType.arme.concat(arme2mains); // Merge all cases
|
||||
|
||||
// To avoid armour and so on...
|
||||
data.data.combat = duplicate( RdDUtility.checkNull(data.itemsByType['arme']));
|
||||
data.data.combat = data.data.combat.concat(arme2mains); // Merge all cases
|
||||
data.data.combat = data.data.combat.sort((a, b) => { if ( a.name > b.name) return 1; else return -1; } );
|
||||
|
||||
if (data.competenceByCategory && data.competenceByCategory.melee) {
|
||||
//Specific case for Esquive and Corps à Corps
|
||||
|
@ -1075,10 +1075,14 @@ export class RdDActor extends Actor {
|
||||
armeItem.data.unemain = true;
|
||||
if (armeItem.data.unemain && armeItem.data.deuxmains) { // manage 1/2 main
|
||||
//console.log("Weapon", armeItem.data.dommages);
|
||||
if ( name.toLowerCase().includes("1 main") )
|
||||
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[0]);
|
||||
else // 2 mains
|
||||
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[1]);
|
||||
if ( armeItem.data.dommages.includes("/") ) { // Sanity check
|
||||
if ( name.toLowerCase().includes("1 main") )
|
||||
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[0]);
|
||||
else // 2 mains
|
||||
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[1]);
|
||||
} else {
|
||||
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + name + " ne sont pas corrects (ie sous la forme X/Y)");
|
||||
}
|
||||
}
|
||||
rollData.arme = armeItem;
|
||||
rollData.carac = this.data.data.carac;
|
||||
|
@ -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.78",
|
||||
"version": "0.9.79",
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.6",
|
||||
"templateVersion": 48,
|
||||
|
Loading…
Reference in New Issue
Block a user