Draft: Mineurs v1.3 #356

Closed
vincent.vandeme wants to merge 2 commits from mineurs-v1.3 into v1.3
Showing only changes of commit dd6e61a916 - Show all commits

View File

@ -175,12 +175,24 @@ export class RdDActor extends Actor {
isCreature() {
return this.data.type == 'creature' || this.data.type == 'entite';
}
/* -------------------------------------------- */
isPersonnage() {
return this.data.type == 'personnage';
}
/* -------------------------------------------- */
getFatigueActuelle() {
if (!this.isPersonnage()) {
return 0;
}
return Misc.toInt(this.data.data.sante.fatigue?.value);
}
/* -------------------------------------------- */
getFatigueMax() {
if (!this.isPersonnage()) {
return 1;
}
return Misc.toInt(this.data.data.sante.fatigue?.max);
}
/* -------------------------------------------- */
getReveActuel() {
return Misc.toInt(this.data.data.reve?.reve?.value ?? this.data.data.carac.reve.value);
@ -1295,14 +1307,17 @@ export class RdDActor extends Actor {
if (sante.fatigue && fatigue > 0) {
sante.fatigue.value = Math.max(sante.fatigue.value + fatigue, this._computeFatigueMin());
}
if (!this.isEntiteCauchemar() && sante.vie.value<-this.getSConst()) {
await this.update({ "data.sante": sante });
if (this.isDead()) {
await this.addStatusEffectById('dead');
}
await this.update({ "data.sante": sante });
return result;
}
isDead() {
return !this.isEntiteCauchemar() && this.data.data.sante.vie.value<-this.getSConst()
}
/* -------------------------------------------- */
_computeFatigueMin() {
return this.data.data.sante.endurance.max - this.data.data.sante.endurance.value;