forked from public/foundryvtt-reve-de-dragon
Fix: récupération des blessures
This commit is contained in:
@ -26,7 +26,7 @@ import { DialogConsommer } from "./dialog-item-consommer.js";
|
||||
import { DialogFabriquerPotion } from "./dialog-fabriquer-potion.js";
|
||||
import { RollDataAjustements } from "./rolldata-ajustements.js";
|
||||
import { RdDPossession } from "./rdd-possession.js";
|
||||
import { ENTITE_INCARNE, ENTITE_NONINCARNE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { ENTITE_INCARNE, ENTITE_NONINCARNE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { RdDConfirm } from "./rdd-confirm.js";
|
||||
import { DialogValidationEncaissement } from "./dialog-validation-encaissement.js";
|
||||
import { RdDRencontre } from "./item/rencontre.js";
|
||||
@ -521,16 +521,17 @@ export class RdDActor extends RdDBaseActor {
|
||||
/* -------------------------------------------- */
|
||||
async _recuperationBlessures(message, isMaladeEmpoisonne) {
|
||||
const timestamp = game.system.rdd.calendrier.getTimestamp()
|
||||
const blessures = this.filterItems(it => it.gravite > 0, 'blessure').sort(Misc.ascending(it => it.system.gravite))
|
||||
const blessures = this.filterItems(it => it.system.gravite > 0, 'blessure').sort(Misc.ascending(it => it.system.gravite))
|
||||
|
||||
Promise.all(blessures.map(b => b.recuperationBlessure({
|
||||
await Promise.all(blessures.map(b => b.recuperationBlessure({
|
||||
actor: this,
|
||||
timestamp,
|
||||
message,
|
||||
isMaladeEmpoisonne,
|
||||
blessures
|
||||
})));
|
||||
await this.supprimerBlessures(filterToDelete);
|
||||
|
||||
await this.supprimerBlessures(it => it.system.gravite <= 0);
|
||||
}
|
||||
|
||||
async supprimerBlessures(filterToDelete) {
|
||||
@ -548,7 +549,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
let vieManquante = tData.sante.vie.max - tData.sante.vie.value;
|
||||
if (vieManquante > 0) {
|
||||
let rolled = await this.jetRecuperationConstitution(bonusSoins, message)
|
||||
let rolled = await this.jetRecuperationConstitution(0, message)
|
||||
if (!isMaladeEmpoisonne && rolled.isSuccess) {
|
||||
const gain = Math.min(rolled.isPart ? 2 : 1, vieManquante);
|
||||
message.content += " -- récupération de vie: " + gain;
|
||||
@ -566,7 +567,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async jetRecuperationConstitution(bonusSoins, message = undefined) {
|
||||
let difficulte = Misc.toInt(bonusSoins) + Math.min(0, this.system.sante.vie.value - this.system.sante.vie.max);
|
||||
let difficulte = Math.min(0, this.system.sante.vie.value - this.system.sante.vie.max) + bonusSoins + this.system.sante.bonusPotion;
|
||||
let rolled = await RdDResolutionTable.roll(this.system.carac.constitution.value, difficulte);
|
||||
if (message) {
|
||||
message.content = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/roll/explain.hbs", {
|
||||
@ -1532,7 +1533,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
_computeEnduranceMax() {
|
||||
const diffVie = this.system.sante.vie.max - this.system.sante.vie.value;
|
||||
const maxEndVie = this.system.sante.endurance.max - (diffVie * 2);
|
||||
const nbGraves = this.countBlessures(it => it.isGraves()) > 0
|
||||
const nbGraves = this.countBlessures(it => it.isGrave()) > 0
|
||||
const nbCritiques = this.countBlessures(it => it.isCritique()) > 0
|
||||
const maxEndGraves = Math.floor(this.system.sante.endurance.max / (2 * nbGraves));
|
||||
const maxEndCritiques = nbCritiques > 0 ? 1 : this.system.sante.endurance.max;
|
||||
|
Reference in New Issue
Block a user