Fix: animaux

- état général corrigé
- ajout de blessure, mise à jour endurance, ...
- calcul du malus d'état général
- ajustement des jets selon points de vie perdus
This commit is contained in:
2023-11-24 02:17:20 +01:00
parent af410c1823
commit f0b7306885
6 changed files with 122 additions and 224 deletions

View File

@ -20,25 +20,17 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
getProtectionNaturelle() { return Number(this.system.attributs?.protection?.value ?? 0) }
getSConst() { return 0 }
getEnduranceMax() {
return Math.max(1, Math.min(this.system.sante.endurance.max, MAX_ENDURANCE_FATIGUE));
}
getEnduranceMax() { return Math.max(1, Math.min(this.system.sante.endurance.max, MAX_ENDURANCE_FATIGUE)) }
getFatigueActuelle() {
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
return Math.max(0, Math.min(this.getFatigueMax(), this.system.sante.fatigue?.value));
return Math.max(0, Math.min(this.getFatigueMax(), this.system.sante.fatigue?.value ?? 0));
}
return 0;
}
getFatigueRestante() {
return this.getFatigueMax() - this.getFatigueActuelle();
}
getFatigueMin() {
return this.system.sante.endurance.max - this.system.sante.endurance.value;
}
getFatigueRestante() { return this.getFatigueMax() - this.getFatigueActuelle() }
getFatigueMin() { return this.system.sante.endurance.max - this.system.sante.endurance.value }
getFatigueMax() { return this.getEnduranceMax() * 2 }
malusFatigue() {
@ -56,19 +48,11 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
return Math.min(0, Math.floor(this.getEncombrementMax() - this.encTotal));
}
isDead() {
return this.system.sante.vie.value < -this.getSConst()
}
isDead() { return this.system.sante.vie.value < -this.getSConst() }
nbBlessuresLegeres() {
return this.itemTypes[TYPES.blessure].filter(it => it.isLegere()).length;
}
nbBlessuresGraves() {
return this.itemTypes[TYPES.blessure].filter(it => it.isGrave()).length;
}
nbBlessuresCritiques() {
return this.itemTypes[TYPES.blessure].filter(it => it.isCritique()).length;
}
nbBlessuresLegeres() { return this.itemTypes[TYPES.blessure].filter(it => it.isLegere()).length }
nbBlessuresGraves() { return this.itemTypes[TYPES.blessure].filter(it => it.isGrave()).length }
nbBlessuresCritiques() { return this.itemTypes[TYPES.blessure].filter(it => it.isCritique()).length }
/* -------------------------------------------- */
computeResumeBlessure() {
@ -97,7 +81,6 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
}
blessuresASoigner() { return [] }
getEtatGeneral(options = { ethylisme: false }) { return 0 }
async computeArmure(attackerRoll) { return this.getProtectionNaturelle() }
async remiseANeuf() { }
@ -173,6 +156,16 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
}
/* -------------------------------------------- */
_computeEnduranceMax() {
const diffVie = this.system.sante.vie.max - this.system.sante.vie.value;
const maxEndVie = this.system.sante.endurance.max - (diffVie * 2);
const nbGraves = this.countBlessures(it => it.isGrave()) > 0
const nbCritiques = this.countBlessures(it => it.isCritique()) > 0
const maxEndGraves = Math.floor(this.system.sante.endurance.max / (2 * nbGraves));
const maxEndCritiques = nbCritiques > 0 ? 1 : this.system.sante.endurance.max;
return Math.max(0, Math.min(maxEndVie, maxEndGraves, maxEndCritiques));
}
/* -------------------------------------------- */
async ajouterBlessure(encaissement, attacker = undefined) {
@ -277,14 +270,10 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
}
/* -------------------------------------------- */
async computeEtatGeneral() {
this.system.compteurs.etat.value = this.malusVie() + this.malusFatigue() + this.malusEthylisme();
}
malusVie() {
return Math.min(this.system.sante.vie.value - this.system.sante.vie.max, 0);
}
async computeEtatGeneral() { this.system.compteurs.etat.value = this.malusVie() + this.malusFatigue() + this.malusEthylisme() }
getEtatGeneral(options = { ethylisme: false }) { return this.system.compteurs.etat.value }
malusVie() { return Math.min(this.system.sante.vie.value - this.system.sante.vie.max, 0) }
malusEthylisme() { return 0 }