forked from public/foundryvtt-reve-de-dragon
Fixes recul/desarmement
# Conflicts: # module/rdd-combat.js
This commit is contained in:
@ -179,18 +179,34 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getReveActuel() {
|
||||
return this.data.data.reve?.reve?.value ?? this.data.data.carac.reve.value;
|
||||
}
|
||||
|
||||
getChanceActuel() {
|
||||
return this.data.data.compteurs.chance?.value ?? 10;
|
||||
return Misc.toInt(this.data.data.reve?.reve?.value ?? this.data.data.carac.reve.value);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getForceValue() {
|
||||
return this.data.data.carac.force?.force ?? this.data.data.carac.reve.value;
|
||||
getChanceActuel() {
|
||||
return Misc.toInt(this.data.data.compteurs.chance?.value ?? 10);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getTaille() {
|
||||
return Misc.toInt(this.data.data.carac.taille?.value);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getForce() {
|
||||
if (this.isEntiteCauchemar()) {
|
||||
return Misc.toInt(this.data.data.carac.reve?.value);
|
||||
}
|
||||
return Misc.toInt(this.data.data.carac.force?.value);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getAgilite() {
|
||||
switch(this.data.type) {
|
||||
case 'personnage': return Misc.toInt(this.data.data.carac.agilite?.value);
|
||||
case 'creature': return Misc.toInt(this.data.data.carac.force?.value);
|
||||
case 'entite': return Misc.toInt(this.data.data.carac.reve?.value);
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
getMoralTotal() {
|
||||
return this.data.data.compteurs.moral?.value ?? 0;
|
||||
return Misc.toInt(this.data.data.compteurs.moral?.value);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getBonusDegat() {
|
||||
@ -203,16 +219,16 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getEtatGeneral() {
|
||||
return this.data.data.compteurs.etat?.value ?? 0;
|
||||
return Misc.toInt(this.data.data.compteurs.etat?.value);
|
||||
}
|
||||
getMalusArmure() {
|
||||
return this.data.data.attributs?.malusarmure?.value ?? 0;
|
||||
return Misc.toInt(this.data.data.attributs?.malusarmure?.value);
|
||||
}
|
||||
getEncTotal() {
|
||||
return Math.floor(this.encTotal ?? 0);
|
||||
}
|
||||
getSurenc() {
|
||||
return this.data.data.compteurs.surenc?.value ?? 0;
|
||||
return Misc.toInt(this.data.data.compteurs.surenc?.value);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
loadCompendiumNames() {
|
||||
@ -229,7 +245,6 @@ export class RdDActor extends Actor {
|
||||
getMeditation(id) {
|
||||
return this.data.items.find(item => item.type == 'meditation' && item._id == id);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getBestDraconic() {
|
||||
const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau);
|
||||
@ -559,8 +574,7 @@ export class RdDActor extends Actor {
|
||||
async updateCarac(caracName, caracValue) {
|
||||
let caracpath = "data.carac." + caracName + ".value"
|
||||
if (caracName == "force") {
|
||||
let caracTaille = this.data.data.carac.taille;
|
||||
if ( Number(caracValue) > Number(caracTaille.value)+4) {
|
||||
if ( Number(caracValue) > this.getTaille() + 4) {
|
||||
ui.notifications.warn("Votre FORCE doit être au maximum de TAILLE+4");
|
||||
return;
|
||||
}
|
||||
@ -580,6 +594,9 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updateCaracXP(caracName, caracXP) {
|
||||
if (caracName == 'Taille') {
|
||||
return;
|
||||
}
|
||||
let caracpath = "data.carac." + caracName + ".xp";
|
||||
await this.update({ [caracpath]: caracXP });
|
||||
this.checkCaracXP(caracName);
|
||||
@ -1971,7 +1988,9 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async appliquerExperience(rolled, caracName, competence = undefined) {
|
||||
|
||||
if (this.isCreature()) {
|
||||
return;
|
||||
}
|
||||
if (rolled.isPart && rolled.finalLevel < 0) {
|
||||
// Cas de désir lancinant, pas d'expérience sur particulière
|
||||
if (this.checkDesirLancinant()) {
|
||||
@ -2222,7 +2241,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async encaisserDommages(rollData, attacker = undefined) {
|
||||
async encaisserDommages(rollData, attacker = undefined, defenderRoll = undefined) {
|
||||
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
|
||||
return;
|
||||
}
|
||||
@ -2241,15 +2260,16 @@ export class RdDActor extends Actor {
|
||||
this.computeEtatGeneral();
|
||||
this.sheet.render(false);
|
||||
|
||||
let santeActuelle = duplicate(this.data.data.sante);
|
||||
|
||||
encaissement.alias = this.data.name;
|
||||
encaissement.hasPlayerOwner = this.hasPlayerOwner;
|
||||
encaissement.resteEndurance = santeActuelle.endurance.value
|
||||
encaissement.sonne = perteEndurance.sonne;
|
||||
encaissement.jetEndurance = perteEndurance.jetEndurance;
|
||||
encaissement.endurance = santeOrig.endurance.value - perteEndurance.newValue;
|
||||
encaissement.vie = this.isEntiteCauchemar() ? 0 : (santeOrig.vie.value - perteVie.newValue);
|
||||
mergeObject(encaissement, {
|
||||
alias: this.data.name,
|
||||
hasPlayerOwner: this.hasPlayerOwner,
|
||||
resteEndurance: this.data.data.sante.endurance.value,
|
||||
sonne: perteEndurance.sonne,
|
||||
jetEndurance: perteEndurance.jetEndurance,
|
||||
endurance: santeOrig.endurance.value - perteEndurance.newValue,
|
||||
vie: this.isEntiteCauchemar() ? 0 : (santeOrig.vie.value - perteVie.newValue),
|
||||
show: defenderRoll?.show ?? {}
|
||||
});
|
||||
|
||||
ChatUtility.createChatWithRollMode(this.name, {
|
||||
roll: encaissement.roll,
|
||||
|
Reference in New Issue
Block a user