foundryvtt-reve-de-dragon/module/item-competencecreature.js
Vincent Vandemeulebrouck 0d599d41f9 Fix parade créatures
2021-01-14 00:35:55 +01:00

38 lines
1.2 KiB
JavaScript

/* -------------------------------------------- */
export class RdDItemCompetenceCreature extends Item {
/* -------------------------------------------- */
static setRollDataCreature(rollData) {
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } };
rollData.competence = duplicate(rollData.competence);
rollData.competence.data.defaut_carac = "carac_creature";
rollData.competence.data.categorie = "creature";
rollData.selectedCarac = rollData.carac.carac_creature;
if (rollData.competence.data.iscombat) {
rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence);
}
}
/* -------------------------------------------- */
static toArme(item) {
if (item.type == 'competencecreature' && item.data.iscombat) {
let arme = { name: item.name, data: duplicate(item.data) };
mergeObject(arme.data,
{
competence: item.name,
resistance: 100,
equipe: true,
penetration: 0,
force: 0,
rapide: true
});
return arme;
}
console.error("RdDItem.toArme(", item, ") : impossible de transformer l'Item en arme");
return undefined;
}
}