Minor fixes

This commit is contained in:
2020-11-30 23:59:16 +01:00
parent d09cf781d6
commit fad02f45e1
4 changed files with 10 additions and 7 deletions

View File

@ -897,6 +897,7 @@ export class RdDActor extends Actor {
if (this.type == 'personnage')
minValue = name == "vie" ? Number(-this.data.data.attributs.sconst.value) : 0;
let newValue = Math.max(minValue, Math.min(data.value + inc, data.max));
//console.log("New value ", inc, minValue, newValue);
if (name == "endurance" && this.data.type != 'entite' ) {
if ( sante.fatigue && inc < 0 ) { // Each endurance lost -> fatigue lost
@ -1291,15 +1292,15 @@ export class RdDActor extends Actor {
}
/* -------------------------------------------- */
encaisserDommages( attackerRoll ) {
async encaisserDommages( attackerRoll ) {
console.log("encaisserDommages", attackerRoll )
const armure = this.computeArmure( attackerRoll.loc, attackerRoll.domArmePlusDom);
let degatsReel = attackerRoll.degats - armure;
let result = RdDUtility.computeBlessuresSante(degatsReel, attackerRoll.mortalite);
if ( this.data.type != 'entite') // Pas de PV chez les entités
this.santeIncDec("vie", result.vie);
this.santeIncDec("endurance", result.endurance);
await this.santeIncDec("vie", result.vie);
await this.santeIncDec("endurance", result.endurance);
result.locName = (attackerRoll.loc) ? attackerRoll.loc.label : "Corps";
this.manageBlessures(result); // Will upate the result table