Minor fixes

This commit is contained in:
sladecraven 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

View File

@ -33,9 +33,11 @@ export class RdDEncaisser extends Dialog {
/* -------------------------------------------- */
performEncaisser(html, mortalite = "mortel") {
const ajustement = Number(this.modifier);
const encaissement = new Roll("2d10").roll().total + ajustement;
this.actor.encaisserDommages({
degats: new Roll("2d10").roll().total,
domArmePlusDom: Number(this.modifier),
degats: encaissement,
domArmePlusDom: ajustement,
loc: { result: 0, label: "Corps" },
mortalite: mortalite
});

View File

@ -508,7 +508,7 @@ export class RdDUtility {
let encaissement = RdDUtility.selectEncaissement(degats, mortalite)
let over20 = degats > 20 ? degats - 20 : 0
encaissement.endurance = - RdDUtility._evaluatePerte(encaissement.endurance, over20)
encaissement.vie = - RdDUtility._evaluatePerte(encaissement.vie, degats, over20)
encaissement.vie = - RdDUtility._evaluatePerte(encaissement.vie, over20)
return encaissement;
}

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
"version": "0.9.95",
"version": "0.9.96",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6",
"templateVersion": 51,