Travail sur queues/souffles

This commit is contained in:
Vincent Vandemeulebrouck
2021-02-06 01:34:49 +01:00
parent 7c54597a20
commit fe73e5b984
3 changed files with 42 additions and 26 deletions

View File

@ -36,7 +36,8 @@ export class RdDTMRDialog extends Dialog {
this.actor = actor;
this.actor.tmrApp = this; // reference this app in the actor structure
this.viewOnly = mode == "visu"
this.nbFatigue = this.viewOnly ? 0 : 1; // 1 premier point de fatigue du à la montée
this.fatigueParCase = this.viewOnly ? 0 : this.actor.getTMRFatigue();
this.cumulFatigue = 0;
this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list);
this.sortReserves = duplicate(this.actor.data.data.reve.reserve.list);
this.casesSpeciales = this.actor.data.items.filter(item => item.type == 'casetmr');
@ -51,7 +52,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
close() {
this.actor.santeIncDec("fatigue", this.nbFatigue).then(super.close()); // moving 1 cell costs 1 fatigue
this.actor.santeIncDec("fatigue", this.cumulFatigue).then(super.close()); // moving 1 cell costs 1 fatigue
this.actor.tmrApp = undefined; // Cleanup reference
this.actor.setStatusDemiReve(false);
if (!this.viewOnly) {
@ -174,7 +175,7 @@ export class RdDTMRDialog extends Dialog {
this.close();
return true;
}
const resteAvantInconscience = this.actor.getFatigueMax() - this.actor.getFatigueActuelle() - this.nbFatigue;
const resteAvantInconscience = this.actor.getFatigueMax() - this.actor.getFatigueActuelle() - this.cumulFatigue;
if (resteAvantInconscience <= 0) {
this._tellToGM("Vous vous écroulez de fatigue : vous quittez les Terres médianes !");
this.quitterLesTMRInconscient();
@ -245,7 +246,7 @@ export class RdDTMRDialog extends Dialog {
else if (rencontreData.rolled.isEchec && rencontreData.rencontre.isPersistant) {
setTimeout(() => {
rencontreData.nbRounds++;
this.nbFatigue += 1;
this.cumulFatigue += this.fatigueParCase;
this._tentativeMaitrise(rencontreData);
this._deleteTmrMessages(rencontreData.actor, rencontreData.nbRounds);
}, 2000);
@ -609,7 +610,7 @@ export class RdDTMRDialog extends Dialog {
await this.actor.update({ "data.reve.tmrpos": tmrPos });
this._updateDemiReve();
this.nbFatigue += 1;
this.cumulFatigue += this.fatigueParCase;
this.updateValuesDisplay();
game.socket.emit("system.foundryvtt-reve-de-dragon", {
msg: "msg_tmr_move", data: {
@ -700,6 +701,7 @@ export class RdDTMRDialog extends Dialog {
// Gestion du cout de montée en points de rêve
let reveCout = (this.tmrdata.isRapide && !this.actor.checkTeteDeplacementAccelere()) ? -2 : -1;
this.cumulFatigue += this.fatigueParCase;
reveCout -= this.actor.checkMonteeLaborieuse();
await this.actor.reveActuelIncDec(reveCout);
// Le reste...
@ -707,7 +709,6 @@ export class RdDTMRDialog extends Dialog {
let tmr = TMRUtility.getTMR(this.actor.data.data.reve.tmrpos.coord);
await this.manageRencontre(tmr, () => {
this.postRencontre(tmr);
this.nbFatigue = this.actor.getTMRFatigue();
this.actor.displayTMRQueueSouffleInformation();
});
}