#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
|
// Force empty arme, at least for Esquive
|
||||||
if (data.itemsByType.arme == undefined ) data.itemsByType.arme = [];
|
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) {
|
for (const arme of data.itemsByType.arme) {
|
||||||
arme.data.niveau = 0; // Per default, TODO to be fixed
|
arme.data.niveau = 0; // Per default, TODO to be fixed
|
||||||
for ( const melee of data.competenceByCategory.melee ) {
|
for ( const melee of data.competenceByCategory.melee ) {
|
||||||
@ -77,6 +76,13 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
if (lancer.name == arme.data.competence )
|
if (lancer.name == arme.data.competence )
|
||||||
arme.data.niveau = lancer.data.niveau
|
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
|
// 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);
|
||||||
@ -88,10 +94,8 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
arme2mains.push(arme2main);
|
arme2mains.push(arme2main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.itemsByType.arme = data.itemsByType.arme.concat(arme2mains); // Merge all cases
|
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; } );
|
||||||
// To avoid armour and so on...
|
|
||||||
data.data.combat = duplicate( RdDUtility.checkNull(data.itemsByType['arme']));
|
|
||||||
|
|
||||||
if (data.competenceByCategory && data.competenceByCategory.melee) {
|
if (data.competenceByCategory && data.competenceByCategory.melee) {
|
||||||
//Specific case for Esquive and Corps à Corps
|
//Specific case for Esquive and Corps à Corps
|
||||||
|
@ -1075,10 +1075,14 @@ export class RdDActor extends Actor {
|
|||||||
armeItem.data.unemain = true;
|
armeItem.data.unemain = true;
|
||||||
if (armeItem.data.unemain && armeItem.data.deuxmains) { // manage 1/2 main
|
if (armeItem.data.unemain && armeItem.data.deuxmains) { // manage 1/2 main
|
||||||
//console.log("Weapon", armeItem.data.dommages);
|
//console.log("Weapon", armeItem.data.dommages);
|
||||||
if ( name.toLowerCase().includes("1 main") )
|
if ( armeItem.data.dommages.includes("/") ) { // Sanity check
|
||||||
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[0]);
|
if ( name.toLowerCase().includes("1 main") )
|
||||||
else // 2 mains
|
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[0]);
|
||||||
armeItem.data.dommagesReels = Number(armeItem.data.dommages.split("/")[1]);
|
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.arme = armeItem;
|
||||||
rollData.carac = this.data.data.carac;
|
rollData.carac = this.data.data.carac;
|
||||||
|
@ -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.78",
|
"version": "0.9.79",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.6",
|
"compatibleCoreVersion": "0.7.6",
|
||||||
"templateVersion": 48,
|
"templateVersion": 48,
|
||||||
|
Loading…
Reference in New Issue
Block a user