Fix TMR
This commit is contained in:
parent
b08b330e65
commit
0e3e6eb6eb
@ -99,6 +99,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
formData.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
formData.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
||||||
|
|
||||||
formData.hautreve = {
|
formData.hautreve = {
|
||||||
|
isDemiReve: this.actor.listeEffets( it => it.label == "Demi-rêve").length > 0,
|
||||||
sortsReserve: formData.data.reve.reserve.list,
|
sortsReserve: formData.data.reve.reserve.list,
|
||||||
rencontres: duplicate(formData.data.reve.rencontre.list),
|
rencontres: duplicate(formData.data.reve.rencontre.list),
|
||||||
casesTmr: formData.itemsByType.casetmr,
|
casesTmr: formData.itemsByType.casetmr,
|
||||||
|
@ -2921,9 +2921,10 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async displayTMR(mode = "normal") {
|
async displayTMR(mode = "normal") {
|
||||||
if ( this.currentTMR != undefined && !this.currentTMR.isClosed) {
|
let demiReve = this.listeEffets( it => it.label == "Demi-rêve");
|
||||||
ui.notifications.warn("Vous êtes déja dans les Terres Médianes !");
|
if ( mode != 'visu' && demiReve.length > 0 ) {
|
||||||
return;
|
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";
|
let isRapide = mode == "rapide";
|
||||||
@ -3864,9 +3865,8 @@ export class RdDActor extends Actor {
|
|||||||
const demiReve = StatusEffects.demiReve();
|
const demiReve = StatusEffects.demiReve();
|
||||||
if (status) {
|
if (status) {
|
||||||
await this.addStatusEffect(demiReve)
|
await this.addStatusEffect(demiReve)
|
||||||
}
|
} else {
|
||||||
else {
|
await this.deleteStatusEffect(demiReve)
|
||||||
this.deleteStatusEffect(demiReve)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3884,26 +3884,31 @@ export class RdDActor extends Actor {
|
|||||||
await this.addStatusEffectById(statusId);
|
await this.addStatusEffectById(statusId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.deleteStatusEffectById(statusId);
|
await this.deleteStatusEffectById(statusId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
deleteStatusEffectById(id) {
|
async deleteStatusEffectById(id) {
|
||||||
|
|
||||||
const ids = Array.from(this.effects?.values())
|
const ids = Array.from(this.effects?.values())
|
||||||
.filter(it => it.data.flags.core?.statusId == id)
|
.filter(it => it.data.flags.core?.statusId == id)
|
||||||
.map(it => it.id);
|
.map(it => it.id);
|
||||||
|
//console.log("Delete effect IDS1: ", this.effects, ids);
|
||||||
if (ids.length > 0) {
|
if (ids.length > 0) {
|
||||||
this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
await this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
deleteStatusEffect(effect) {
|
async deleteStatusEffect(effect) {
|
||||||
const ids = Array.from(this.effects?.values())
|
const ids = Array.from(this.effects?.values())
|
||||||
.filter(it => StatusEffects.statusId(it.data) == StatusEffects.statusId(effect))
|
.filter(it => StatusEffects.statusId(it.data) == StatusEffects.statusId(effect))
|
||||||
.map(it => it.id);
|
.map(it => it.id);
|
||||||
this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
//console.log("Delete effect 1: ", this.effects, ids);
|
||||||
|
if (ids.length > 0) {
|
||||||
|
await this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -3915,10 +3920,13 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async addStatusEffect(statusEffect) {
|
async addStatusEffect(statusEffect) {
|
||||||
const effet = Misc.data(statusEffect);
|
const effet = Misc.data(statusEffect);
|
||||||
this.deleteStatusEffectById(effet.id);
|
await this.deleteStatusEffectById(effet.id);
|
||||||
effet.flags = effet.flags ?? { core: {} };
|
//effet.flags = effet.flags ?? { core: {} };
|
||||||
effet.flags.core.statusId = effet.id;
|
//effet.flags.core.statusId = effet.id;
|
||||||
await this.createEmbeddedDocuments('ActiveEffect', [effet]);
|
let effectArray = await this.createEmbeddedDocuments('ActiveEffect', [effet]);
|
||||||
|
if (effectArray[0]) {
|
||||||
|
await effectArray[0].setFlag( 'core', 'statusId', effet.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -273,11 +273,10 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
close() {
|
close() {
|
||||||
this.actor.santeIncDec("fatigue", this.cumulFatigue).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.tmrApp = undefined; // Cleanup reference
|
||||||
|
if ( !this.viewOnly ) {
|
||||||
this.actor.setStatusDemiReve(false);
|
this.actor.setStatusDemiReve(false);
|
||||||
if (!this.viewOnly) {
|
|
||||||
this._tellToGM(this.actor.name + " a quitté les terres médianes");
|
this._tellToGM(this.actor.name + " a quitté les terres médianes");
|
||||||
}
|
}
|
||||||
ths.isClosed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
<span class="dormir-une-heure"><a title="Dormir une heure"><img class="button-img" src="icons/svg/sleep.svg" alt="Dormir une heure"/></a></span>
|
<span class="dormir-une-heure"><a title="Dormir une heure"><img class="button-img" src="icons/svg/sleep.svg" alt="Dormir une heure"/></a></span>
|
||||||
<span class="dormir-chateau-dormant"><a title="Chateau Dormant"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg" alt="Chateau Dormant"/></a></span>
|
<span class="dormir-chateau-dormant"><a title="Chateau Dormant"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd12.svg" alt="Chateau Dormant"/></a></span>
|
||||||
{{#if data.attributs.hautrevant.value}}
|
{{#if data.attributs.hautrevant.value}}
|
||||||
<span class="monte-tmr"><a title="Montée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres Médianes !"/></a></span>
|
<span class="monte-tmr"><a title="Montée dans les Terres Médianes !" {{#if hautreve.isDemiReve}}disabled{{/if}}><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg" alt="Montée dans les Terres Médianes !"/></a></span>
|
||||||
<span class="monte-tmr-rapide"><a title="Montée accélérée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres Médianes !"/></a></span>
|
<span class="monte-tmr-rapide"><a title="Montée accélérée dans les Terres Médianes !"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-rapide.svg" alt="Montée accélérée dans les Terres Médianes !"/></a></span>
|
||||||
<span class="visu-tmr"><a title="Regarder les Terres Médianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres Médianes"/></a></span>
|
<span class="visu-tmr"><a title="Regarder les Terres Médianes"><img class="button-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-view.svg" alt="Regarder les Terres Médianes"/></a></span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
<table id="tmrsheet">
|
<table id="tmrsheet">
|
||||||
<tr id="tmrrow1">
|
<tr id="tmrrow1">
|
||||||
<td>
|
<td>
|
||||||
|
{{#if (eq mode "visu")}}
|
||||||
|
{{else}}
|
||||||
<div class="flex-group-center">
|
<div class="flex-group-center">
|
||||||
<img class="small-button-direction" id='dir-top-left' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top-left.svg'>
|
<img class="small-button-direction" id='dir-top-left' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top-left.svg'>
|
||||||
<img class="small-button-direction" id='dir-top' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top.svg'>
|
<img class="small-button-direction" id='dir-top' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-top.svg'>
|
||||||
@ -14,6 +16,7 @@
|
|||||||
<img class="small-button-direction" id='dir-bottom' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom.svg'>
|
<img class="small-button-direction" id='dir-bottom' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom.svg'>
|
||||||
<img class="small-button-direction" id='dir-bottom-right' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom-right.svg'>
|
<img class="small-button-direction" id='dir-bottom-right' src='systems/foundryvtt-reve-de-dragon/styles/img/ui/dir-bottom-right.svg'>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
<div class="flex-group-center lire-signe-draconique">
|
<div class="flex-group-center lire-signe-draconique">
|
||||||
<a>Lire un signe draconique</a>
|
<a>Lire un signe draconique</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user