diff --git a/module/actor.js b/module/actor.js index 497bd73d..61f20a8a 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2450,9 +2450,10 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async displayTMR(mode = "normal") { - if (this.currentTMR != undefined && !this.currentTMR.isClosed) { - ui.notifications.warn('Vous êtes déja dans les Terres Médianes !'); - return; + let demiReve = this.listeEffets( it => it.label == "Demi-rêve"); + if ( mode != 'visu' && demiReve.length > 0 ) { + ui.notifications.warn("Le joueur ou le MJ est déja dans les Terres Médianes avec ce personnage ! Visualisation uniquement"); + mode = "visu"; // bascule le mode en visu automatiquement } let isRapide = mode == "rapide"; @@ -3054,7 +3055,7 @@ export class RdDActor extends Actor { await this.addStatusEffect(StatusEffects.demiReve()) } else { - this.deleteStatusEffect(StatusEffects.demiReve()) + await this.deleteStatusEffect(StatusEffects.demiReve()) } } @@ -3110,8 +3111,11 @@ export class RdDActor extends Actor { async addStatusEffect(statusEffect, options = { renderSheet: false }) { this.deleteStatusEffectById(statusEffect.id, options); const effet = duplicate(statusEffect); - effet["flags.core.statusId"] = effet.id; - await this.createEmbeddedEntity('ActiveEffect', effet, options); + //effet["flags.core.statusId"] = effet.id; + let entity = await this.createEmbeddedEntity('ActiveEffect', effet, options); + if (entity) { + await entity.setFlag('core', 'statusId', effet.id ); + } } /* -------------------------------------------- */ diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 01a0d3d6..70d059fe 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -202,11 +202,10 @@ export class RdDTMRDialog extends Dialog { close() { 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) { + this.actor.setStatusDemiReve(false); this._tellToGM(this.actor.name + " a quitté les terres médianes"); } - this.isClosed = true; } diff --git a/system.json b/system.json index 1a87805e..6a5718b9 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "1.3.60", + "version": "1.3.61", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.9",