## v11.0.26 - le crépuscule de Khrachtchoum #673

Merged
uberwald merged 6 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2023-10-24 07:07:01 +02:00
4 changed files with 20 additions and 18 deletions
Showing only changes of commit c950f568fd - Show all commits

View File

@ -2149,7 +2149,6 @@ export class RdDActor extends RdDBaseActor {
return; return;
} }
const draconicList = this.computeDraconicAndSortIndex(sorts); const draconicList = this.computeDraconicAndSortIndex(sorts);
const reve = duplicate(this.system.carac.reve); const reve = duplicate(this.system.carac.reve);
@ -2169,7 +2168,10 @@ export class RdDActor extends RdDBaseActor {
diffLibre: RdDItemSort.getDifficulte(sorts[0], -7), // Per default at startup diffLibre: RdDItemSort.getDifficulte(sorts[0], -7), // Per default at startup
coutreve: Array(30).fill().map((item, index) => 1 + index), coutreve: Array(30).fill().map((item, index) => 1 + index),
}, },
callbackAction: r => this._rollUnSortResult(r) callbackAction: async r => {
await this._rollUnSortResult(r);
if (!r.isSortReserve) this.tmrApp?.close();
}
}); });
this.tmrApp?.setTMRPendingAction(dialog); this.tmrApp?.setTMRPendingAction(dialog);
} }
@ -2262,17 +2264,11 @@ export class RdDActor extends RdDBaseActor {
reveActuel = Math.max(reveActuel - rollData.depenseReve, 0); reveActuel = Math.max(reveActuel - rollData.depenseReve, 0);
await this.update({ "system.reve.reve.value": reveActuel }); await this.update({ "system.reve.reve.value": reveActuel });
if (rollData.isSortReserve) {
this.tmrApp.maximize(); // Re-display TMR
} else {
this.tmrApp.close(); // Close TMR !
}
// Final chat message // Final chat message
await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-sort.html'); await RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-sort.html');
if (reveActuel == 0) { // 0 points de reve if (reveActuel == 0) { // 0 points de reve
ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" }); ChatMessage.create({ content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
closeTMR = true;
} }
} }

View File

@ -39,7 +39,8 @@ export class RdDTMRDialog extends Dialog {
content: html, content: html,
buttons: { buttons: {
closeButton: { closeButton: {
label: "Fermer", callback: html => this.close() } label: "Fermer", callback: html => this.close()
}
}, },
default: "closeButton" default: "closeButton"
} }
@ -93,6 +94,9 @@ export class RdDTMRDialog extends Dialog {
setTMRPendingAction(dialog) { setTMRPendingAction(dialog) {
this.subdialog = dialog this.subdialog = dialog
if (dialog instanceof Application) {
dialog.bringToTop();
}
} }
isDemiReveCache() { isDemiReveCache() {
@ -579,9 +583,12 @@ export class RdDTMRDialog extends Dialog {
_presentCite(tmr) { _presentCite(tmr) {
const presentCite = this.casesSpeciales.find(c => EffetsDraconiques.presentCites.isCase(c, tmr.coord)); const presentCite = this.casesSpeciales.find(c => EffetsDraconiques.presentCites.isCase(c, tmr.coord));
if (presentCite) { if (presentCite) {
this.minimize();
const caseData = presentCite; const caseData = presentCite;
EffetsDraconiques.presentCites.choisirUnPresent(caseData, (present => this._utiliserPresentCite(presentCite, present, tmr))); const dialog = EffetsDraconiques.presentCites.choisirUnPresent(caseData, present => {
this._utiliserPresentCite(presentCite, present, tmr)
this.restoreTMRAfterAction();
});
this.setTMRPendingAction(dialog);
} }
return presentCite; return presentCite;
} }
@ -607,8 +614,6 @@ export class RdDTMRDialog extends Dialog {
presentCite: presentCite presentCite: presentCite
}; };
await this._tentativeMaitrise(rencontreData); await this._tentativeMaitrise(rencontreData);
this.maximize();
this.postRencontre(tmr); this.postRencontre(tmr);
} }
@ -815,22 +820,22 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _maitriserTMR(rollData, callbackMaitrise) { async _maitriserTMR(rollData, callbackMaitrise) {
this.minimize(); // Hide
rollData.isTMRCache = rollData.actor.isTMRCache(); rollData.isTMRCache = rollData.actor.isTMRCache();
const dialog = await RdDRoll.create(this.actor, rollData, const dialog = await RdDRoll.create(this.actor, rollData,
{ {
html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-maitrise-tmr.html', html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-maitrise-tmr.html',
close: html => { this.restoreTMRAfterAction(); }
}, },
{ {
name: rollData.maitrise.verbe, label: rollData.maitrise.action, name: rollData.maitrise.verbe, label: rollData.maitrise.action,
callbacks: [ callbacks: [
this.actor.createCallbackExperience(), this.actor.createCallbackExperience(),
{ action: r => { this.restoreTMRAfterAction() } },
{ action: callbackMaitrise } { action: callbackMaitrise }
] ]
} }
); );
dialog.render(true); dialog.render(true);
this.setTMRPendingAction(dialog);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -34,6 +34,7 @@ export class RdDTMRRencontreDialog extends Dialog {
async onButtonAction(action) { async onButtonAction(action) {
this.toClose = true; this.toClose = true;
await this.actor.tmrApp?.restoreTMRAfterAction();
this.actor.tmrApp?.onActionRencontre(action, this.tmr, this.rencontre) this.actor.tmrApp?.onActionRencontre(action, this.tmr, this.rencontre)
} }
@ -41,7 +42,6 @@ export class RdDTMRRencontreDialog extends Dialog {
async close() { async close() {
if (this.actor.tmrApp){ if (this.actor.tmrApp){
if (this.toClose) { if (this.toClose) {
this.actor.tmrApp?.restoreTMRAfterAction();
return await super.close(); return await super.close();
} }
else { else {

View File

@ -49,12 +49,13 @@ export class PresentCites extends Draconique {
const presents = await game.system.rdd.rencontresTMR.getPresentsCite() const presents = await game.system.rdd.rencontresTMR.getPresentsCite()
const buttons = {}; const buttons = {};
presents.forEach(r => buttons['present'+r.id] = { icon: '<i class="fas fa-check"></i>', label: r.name, callback: async () => onChoixPresent(r) }); presents.forEach(r => buttons['present'+r.id] = { icon: '<i class="fas fa-check"></i>', label: r.name, callback: async () => onChoixPresent(r) });
let d = new Dialog({ let dialog = new Dialog({
title: "Présent des cités", title: "Présent des cités",
content: `La ${this.tmrLabel(casetmr)} vous offre un présent, faites votre choix`, content: `La ${this.tmrLabel(casetmr)} vous offre un présent, faites votre choix`,
buttons: buttons buttons: buttons
}); });
d.render(true); dialog.render(true);
return dialog
} }
async ouvrirLePresent(actor, casetmr) { async ouvrirLePresent(actor, casetmr) {