Correction mise à jour état général
This commit is contained in:
parent
7045b6d8e1
commit
e869d15b24
@ -36,6 +36,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
this.timerRecherche = undefined;
|
||||
this.actor.computeEtatGeneral();
|
||||
|
||||
let formData = {
|
||||
title: this.title,
|
||||
|
@ -147,6 +147,7 @@ export class RdDActor extends Actor {
|
||||
if (this.isPersonnage()) this._prepareCharacterData(this)
|
||||
if (this.isCreature()) this._prepareCreatureData(this)
|
||||
if (this.isVehicule()) this._prepareVehiculeData(this)
|
||||
this.computeEtatGeneral();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -162,7 +163,6 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
_prepareCreatureData(actorData) {
|
||||
this.computeEncombrementTotalEtMalusArmure();
|
||||
this.computeEtatGeneral();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -180,7 +180,6 @@ export class RdDActor extends Actor {
|
||||
this.computeIsHautRevant();
|
||||
await this.cleanupConteneurs();
|
||||
await this.computeEncombrementTotalEtMalusArmure();
|
||||
this.computeEtatGeneral();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1400,21 +1399,22 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
computeEtatGeneral() {
|
||||
// Pas d'état général pour les entités forçage à 0
|
||||
if (this.type == 'vehicule') {
|
||||
return
|
||||
}
|
||||
if (this.type == 'entite') {
|
||||
this.system.compteurs.etat.value = 0;
|
||||
return
|
||||
}
|
||||
// Pour les autres
|
||||
let sante = this.system.sante
|
||||
let compteurs = this.system.compteurs
|
||||
let state = Math.min(sante.vie.value - sante.vie.max, 0);
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue") && sante.fatigue) {
|
||||
state += RdDUtility.currentFatigueMalus(sante.fatigue.value, sante.endurance.max);
|
||||
let state = Math.min(this.system.sante.vie.value - this.system.sante.vie.max, 0);
|
||||
if (ReglesOptionelles.isUsing("appliquer-fatigue") && this.system.sante.fatigue) {
|
||||
state += RdDUtility.currentFatigueMalus(this.system.sante.fatigue.value, this.system.sante.endurance.max);
|
||||
}
|
||||
// Ajout de l'éthylisme
|
||||
state += Math.min(0, (compteurs.ethylisme?.value ?? 0));
|
||||
state += Math.min(0, (this.system.compteurs.ethylisme?.value ?? 0));
|
||||
|
||||
compteurs.etat.value = state;
|
||||
this.system.compteurs.etat.value = state;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -3377,8 +3377,6 @@ export class RdDActor extends Actor {
|
||||
: await this.santeIncDec("vie", -encaissement.vie);
|
||||
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, encaissement.critiques > 0);
|
||||
|
||||
this.computeEtatGeneral();
|
||||
|
||||
mergeObject(encaissement, {
|
||||
alias: this.name,
|
||||
hasPlayerOwner: this.hasPlayerOwner,
|
||||
|
Loading…
Reference in New Issue
Block a user