940baad04c
* messages plus clairs * initiatives * en cas de possession en cours, c'est la seule action possible * accès dans le HUD
52 lines
1.9 KiB
JavaScript
52 lines
1.9 KiB
JavaScript
import { Misc } from "./misc.js";
|
|
|
|
/* -------------------------------------------- */
|
|
export class RdDItemCompetenceCreature extends Item {
|
|
|
|
/* -------------------------------------------- */
|
|
static setRollDataCreature(rollData) {
|
|
rollData.competence = Misc.data(rollData.competence);
|
|
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.data.carac_value } };
|
|
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.toActionArme(rollData.competence);
|
|
}
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static toActionArme(item) {
|
|
if (RdDItemCompetenceCreature.isCompetenceAttaque(item)) {
|
|
// si c'est un Item compétence: cloner pour ne pas modifier la compétence
|
|
let arme = Misc.data( (item instanceof Item) ? item.clone(): item);
|
|
mergeObject(arme.data,
|
|
{
|
|
competence: arme.name,
|
|
resistance: 100,
|
|
equipe: true,
|
|
dommagesReels: arme.data.dommages,
|
|
penetration: 0,
|
|
force: 0,
|
|
rapide: true,
|
|
action: 'attaque'
|
|
});
|
|
return arme;
|
|
}
|
|
console.error("RdDItemCompetenceCreature.toActionArme(", item, ") : impossible de transformer l'Item en arme");
|
|
return undefined;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static isCompetenceAttaque(itemData) {
|
|
itemData = Misc.data(itemData);
|
|
return itemData.type == 'competencecreature' && itemData.data.iscombat;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static isCompetenceParade(itemData) {
|
|
itemData = Misc.data(itemData);
|
|
return itemData.type == 'competencecreature' && itemData.data.isparade;
|
|
}
|
|
}
|