2020-12-12 21:58:44 +01:00
|
|
|
|
|
|
|
export class RdDItemArme extends Item {
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
static getCategorieArme(arme) {
|
|
|
|
if (arme.data.competence == undefined) {
|
|
|
|
return 'competencecreature';
|
|
|
|
}
|
|
|
|
let compname = arme.data.competence.toLowerCase();
|
|
|
|
|
|
|
|
if (compname.match("hache")) return "hache";
|
|
|
|
if (compname.match("hast")) return "hast";
|
|
|
|
if (compname.match("lance")) return "lance";
|
|
|
|
if (compname.match("bouclier")) return "bouclier";
|
|
|
|
if (compname.match("masse")) return "masse";
|
|
|
|
if (compname.match("fléau")) return "fleau";
|
|
|
|
if (compname.match("epée") || compname.match("épée")) {
|
|
|
|
let armename = arme.name.toLowerCase();
|
|
|
|
if (armename.match("gnome"))
|
|
|
|
return "epee_courte";
|
|
|
|
return "epee_longue";
|
|
|
|
}
|
|
|
|
if (compname.match("dague")) {
|
|
|
|
return "epee_courte";
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
static needParadeSignificative(armeAttaque, armeParade) {
|
|
|
|
let attCategory = RdDItemArme.getCategorieArme(armeAttaque);
|
|
|
|
let defCategory = RdDItemArme.getCategorieArme(armeParade);
|
|
|
|
if (defCategory == "bouclier" || attCategory == defCategory) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
let armeParadeName = armeParade.name.toLowerCase();
|
|
|
|
let armeAttaqueName = armeAttaque.name.toLowerCase();
|
|
|
|
if (armeParadeName.match("dague") && armeAttaqueName.match(/((e|é)pée dragone|esparlongue|demi-dragonne)/)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// Manage weapon categories when parrying (cf. page 115 )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
static armeUneOuDeuxMains(arme, aUneMain) {
|
2020-12-16 23:02:15 +01:00
|
|
|
if (arme) {
|
|
|
|
arme.data.unemain = arme.data.unemain || !arme.data.deuxmains;
|
|
|
|
const uneOuDeuxMains = arme.data.unemain && arme.data.deuxmains;
|
|
|
|
const containsSlash = !Number.isInteger(arme.data.dommages) && arme.data.dommages.includes("/");
|
|
|
|
if (containsSlash) { // Sanity check
|
|
|
|
arme = duplicate(arme);
|
2020-12-12 21:58:44 +01:00
|
|
|
|
2020-12-16 23:02:15 +01:00
|
|
|
const tableauDegats = arme.data.dommages.split("/");
|
|
|
|
if (aUneMain)
|
|
|
|
arme.data.dommagesReels = Number(tableauDegats[0]);
|
|
|
|
else // 2 mains
|
|
|
|
arme.data.dommagesReels = Number(tableauDegats[1]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
arme.data.dommagesReels = Number(arme.data.dommages);
|
|
|
|
}
|
2020-12-12 21:58:44 +01:00
|
|
|
|
2020-12-16 23:02:15 +01:00
|
|
|
if (uneOuDeuxMains != containsSlash) {
|
|
|
|
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + arme.name + " ne sont pas corrects (ie sous la forme X/Y)");
|
|
|
|
}
|
2020-12-12 21:58:44 +01:00
|
|
|
}
|
|
|
|
return arme;
|
|
|
|
}
|
|
|
|
|
2020-12-16 23:02:15 +01:00
|
|
|
static mainsNues() {
|
2020-12-17 00:23:40 +01:00
|
|
|
const mainsNues = {
|
2020-12-16 23:02:15 +01:00
|
|
|
name: "Mains nues",
|
2020-12-17 12:29:54 +01:00
|
|
|
data: { unemain: true, deuxmains: false, dommages: 0, dommagesReels: 0, mortalite: 'non-mortel', competence: 'Corps à corps', sansArme:true }
|
2020-12-17 00:23:40 +01:00
|
|
|
};
|
|
|
|
return mainsNues
|
2020-12-16 23:02:15 +01:00
|
|
|
}
|
2020-12-12 21:58:44 +01:00
|
|
|
}
|