Vincent Vandemeulebrouck
e46f35ef92
Les créatures peuvent avoir des compétences d'armes (lancer, mêlée, tir, armes naturelles), de parade, de possession, et générales. Les initiatives sont cohérentes. Les possessions sont en phase 10 d'initiative.
100 lines
3.0 KiB
JavaScript
100 lines
3.0 KiB
JavaScript
|
|
import { RdDItem, TYPES } from "./item.js";
|
|
import { RdDCombatManager } from "./rdd-combat.js";
|
|
|
|
const categories = {
|
|
"generale": { base: 0, label: "Générale" },
|
|
"naturelle": { base: 0, label: "Arme naturelle" },
|
|
"melee": { base: 0, label: "Mêlée" },
|
|
"parade": { base: 0, label: "Parade" },
|
|
"tir": { base: 0, label: "Tir" },
|
|
"lancer": { base: 0, label: "Lancer" },
|
|
"possession": { base: 0, label: "Possession" },
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
export class RdDItemCompetenceCreature extends Item {
|
|
|
|
static getCategories() {
|
|
return categories;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static setRollDataCreature(rollData) {
|
|
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.system.carac_value } }
|
|
rollData.competence.system.defaut_carac = "carac_creature"
|
|
rollData.selectedCarac = rollData.carac.carac_creature
|
|
rollData.arme = RdDItemCompetenceCreature.armeCreature(rollData.competence);
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static armeCreature(item) {
|
|
const categorieAttaque = RdDItemCompetenceCreature.getCategorieAttaque(item)
|
|
if (categorieAttaque != undefined) {
|
|
// si c'est un Item compétence: cloner pour ne pas modifier la compétence
|
|
let arme = item.clone();
|
|
mergeObject(arme,
|
|
{
|
|
action: item.isCompetencePossession() ? 'possession' : 'attaque',
|
|
system: {
|
|
competence: arme.name,
|
|
cac: categorieAttaque == "naturelle" ? "naturelle" : "",
|
|
niveau: item.system.niveau,
|
|
initiative: RdDCombatManager.calculInitiative(item.system.niveau, item.system.carac_value),
|
|
equipe: true,
|
|
resistance: 100,
|
|
dommagesReels: arme.system.dommages,
|
|
penetration: 0,
|
|
force: 0,
|
|
rapide: true,
|
|
}
|
|
});
|
|
return arme;
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static getCategorieAttaque(item) {
|
|
if (item.type == TYPES.competencecreature) {
|
|
switch (item.system.categorie) {
|
|
case "melee":
|
|
case "tir":
|
|
case "lancer":
|
|
case "naturelle":
|
|
case "possession":
|
|
return item.system.categorie
|
|
}
|
|
}
|
|
return undefined
|
|
}
|
|
static isDommages(item) {
|
|
if (item.type == TYPES.competencecreature) {
|
|
switch (item.system.categorie) {
|
|
case "melee":
|
|
case "tir":
|
|
case "lancer":
|
|
case "naturelle":
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
static isParade(item) {
|
|
if (item.type == TYPES.competencecreature) {
|
|
switch (item.system.categorie) {
|
|
case "melee":
|
|
case "naturelle":
|
|
case "parade":
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
static isCompetenceParade(item) {
|
|
return item.type == 'competencecreature' && item.system.categorie_parade !== "";
|
|
}
|
|
}
|