Combat séparé par actions
la classe RdDCombat a pour vocation de gérer les interactions entre attaques, défenses, ... Séparation de: - attaque - parades - esquive - encaisser gestion des résultats de dés par actions - _onAttaqueParticuliere - _onAttaqueNormale - _onAttaqueEchec - _onAttaqueEchecTotal - _onParadeParticuliere - _onParadeNormale - _onParadeEchec - _onParadeEchecTotal - _onEsquiveParticuliere - _onEsquiveNormale - _onEsquiveEchec - _onEsquiveEchecTotal Séparation de demiSurprise et de needSignificative les callbacks des boutons dans le chat sont enregistrés cette classe Par ailleurs: - Fix mortel/non-mortel (coche puis décoche restait non-mortel) - création de classes pour les armes, les compétences - fix du recul (ne pouvait pas marcher)
This commit is contained in:
71
module/item-arme.js
Normal file
71
module/item-arme.js
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
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) {
|
||||
arme.data.unemain = arme.data.unemain || !arme.data.deuxmains;
|
||||
const uneOuDeuxMains = arme.data.unemain && arme.data.deuxmains;
|
||||
if (arme.data.dommages.includes("/")) { // Sanity check
|
||||
arme = duplicate(arme);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (
|
||||
(uneOuDeuxMains && !arme.data.dommages.includes("/")) ||
|
||||
(!uneOuDeuxMains && arme.data.dommages.includes("/")))
|
||||
{
|
||||
ui.notifications.info("Les dommages de l'arme à 1/2 mains " + arme.name + " ne sont pas corrects (ie sous la forme X/Y)");
|
||||
}
|
||||
return arme;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user