forked from public/foundryvtt-reve-de-dragon
#27 Gestion des rencontres
This commit is contained in:
@ -768,7 +768,7 @@ export class RdDActor extends Actor {
|
||||
async santeIncDec(name, inc ) {
|
||||
const sante = duplicate(this.data.data.sante);
|
||||
let data = sante[name];
|
||||
let minValue = name == "vie" ? - this.data.data.attributs.sconst : 0;
|
||||
let minValue = name == "vie" ? Number(-this.data.data.attributs.sconst.value) : 0;
|
||||
let newValue = Math.max(minValue, Math.min(data.value + inc, data.max));
|
||||
|
||||
if (name == "endurance" && this.data.type != 'entite' ) {
|
||||
@ -789,7 +789,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
data.value = newValue;
|
||||
//console.log(name, inc, data.value);
|
||||
//console.log(name, inc, data.value, newValue, minValue, data.max);
|
||||
if ( sante.fatigue) { // If endurance lost, then the same amount of fatigue cannot be recovered
|
||||
sante.fatigue.value = Math.max(sante.fatigue.value, this._computeFatigueMin());
|
||||
}
|
||||
@ -798,10 +798,12 @@ export class RdDActor extends Actor {
|
||||
await this.update( {"data.sante": sante } );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeFatigueMin() {
|
||||
return this.data.data.sante.endurance.max - this.data.data.sante.endurance.value;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeEnduranceMax() {
|
||||
let blessures = this.data.data.blessures;
|
||||
let diffVie = this.data.data.sante.vie.max - this.data.data.sante.vie.value;
|
||||
|
Reference in New Issue
Block a user