2021-01-04 00:17:22 +01:00
|
|
|
/* -------------------------------------------- */
|
|
|
|
export class RdDItemCompetenceCreature extends Item {
|
|
|
|
|
2021-01-13 23:47:12 +01:00
|
|
|
/* -------------------------------------------- */
|
|
|
|
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) {
|
2021-01-14 00:35:55 +01:00
|
|
|
rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence);
|
2021-01-13 23:47:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-01-04 00:17:22 +01:00
|
|
|
/* -------------------------------------------- */
|
|
|
|
static toArme(item) {
|
2021-01-28 00:27:44 +01:00
|
|
|
if (RdDItemCompetenceCreature.isCompetenceAttaque(item)) {
|
2021-01-04 00:17:22 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-01-28 00:27:44 +01:00
|
|
|
static isCompetenceAttaque(item) {
|
|
|
|
return item.type == 'competencecreature' && item.data.iscombat;
|
|
|
|
}
|
|
|
|
|
|
|
|
static isCompetenceParade(item) {
|
|
|
|
return item.type == 'competencecreature' && item.data.isparade;
|
|
|
|
}
|
2021-01-04 00:17:22 +01:00
|
|
|
}
|