Fix de la séquence TMR
Lors d'une rencontre/case humide/conquête/..., le haut rêvant déclenchait tout de même les sorts en réserve
This commit is contained in:
parent
c37c68e6db
commit
21fc62b302
@ -214,24 +214,12 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
this.actor.rollLireSigneDraconique(this._getActorCoord());
|
this.actor.rollLireSigneDraconique(this._getActorCoord());
|
||||||
});
|
});
|
||||||
|
|
||||||
html.find('#dir-top').click((event) => {
|
html.find('#dir-top').click((event) => this.moveFromKey("top"));
|
||||||
this.moveFromKey("top");
|
html.find('#dir-top-left').click((event) => this.moveFromKey("top-left"));
|
||||||
});
|
html.find('#dir-top-right').click((event) => this.moveFromKey("top-right"));
|
||||||
html.find('#dir-top-left').click((event) => {
|
html.find('#dir-bottom-left').click((event) => this.moveFromKey("bottom-left"));
|
||||||
this.moveFromKey("top-left");
|
html.find('#dir-bottom-right').click((event) => this.moveFromKey("bottom-right"));
|
||||||
});
|
html.find('#dir-bottom').click((event) => this.moveFromKey("bottom"));
|
||||||
html.find('#dir-top-right').click((event) => {
|
|
||||||
this.moveFromKey("top-right");
|
|
||||||
});
|
|
||||||
html.find('#dir-bottom-left').click((event) => {
|
|
||||||
this.moveFromKey("bottom-left");
|
|
||||||
});
|
|
||||||
html.find('#dir-bottom-right').click((event) => {
|
|
||||||
this.moveFromKey("bottom-right");
|
|
||||||
});
|
|
||||||
html.find('#dir-bottom').click((event) => {
|
|
||||||
this.moveFromKey("bottom");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Gestion du cout de montée en points de rêve
|
// Gestion du cout de montée en points de rêve
|
||||||
let reveCout = ((this.tmrdata.isRapide && !EffetsDraconiques.isDeplacementAccelere(this.actor)) ? -2 : -1) - this.actor.countMonteeLaborieuse();
|
let reveCout = ((this.tmrdata.isRapide && !EffetsDraconiques.isDeplacementAccelere(this.actor)) ? -2 : -1) - this.actor.countMonteeLaborieuse();
|
||||||
@ -243,9 +231,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
// Le reste...
|
// Le reste...
|
||||||
this.updateValuesDisplay();
|
this.updateValuesDisplay();
|
||||||
let tmr = TMRUtility.getTMR(this._getActorCoord());
|
let tmr = TMRUtility.getTMR(this._getActorCoord());
|
||||||
await this.manageRencontre(tmr, () => {
|
await this.manageRencontre(tmr);
|
||||||
this.postRencontre(tmr);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -281,6 +267,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async close() {
|
async close() {
|
||||||
|
this.descenteTMR = true;
|
||||||
if (this.actor.tmrApp) {
|
if (this.actor.tmrApp) {
|
||||||
this.actor.tmrApp = undefined; // Cleanup reference
|
this.actor.tmrApp = undefined; // Cleanup reference
|
||||||
if (!this.viewOnly) {
|
if (!this.viewOnly) {
|
||||||
@ -486,12 +473,13 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async manageRencontre(tmr, postRencontre) {
|
async manageRencontre(tmr) {
|
||||||
if (this.viewOnly) {
|
if (this.viewOnly) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.descenteTMR = false;
|
||||||
this.currentRencontre = undefined;
|
this.currentRencontre = undefined;
|
||||||
if (this._presentCite(tmr, postRencontre)) {
|
if (this._presentCite(tmr)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let rencontre = await this._jetDeRencontre(tmr);
|
let rencontre = await this._jetDeRencontre(tmr);
|
||||||
@ -501,27 +489,27 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
console.log("manageRencontre", rencontre);
|
console.log("manageRencontre", rencontre);
|
||||||
this.currentRencontre = duplicate(rencontre);
|
this.currentRencontre = duplicate(rencontre);
|
||||||
|
|
||||||
let dialog = new RdDTMRRencontreDialog("", this, this.currentRencontre, postRencontre);
|
let dialog = new RdDTMRRencontreDialog(this, this.currentRencontre, () => this.postRencontre(tmr));
|
||||||
dialog.render(true);
|
dialog.render(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
postRencontre();
|
this.postRencontre(tmr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_presentCite(tmr, postRencontre) {
|
_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();
|
this.minimize();
|
||||||
const caseData = presentCite;
|
const caseData = presentCite;
|
||||||
EffetsDraconiques.presentCites.choisirUnPresent(caseData, (type => this._utiliserPresentCite(presentCite, type, tmr, postRencontre)));
|
EffetsDraconiques.presentCites.choisirUnPresent(caseData, (type => this._utiliserPresentCite(presentCite, type, tmr)));
|
||||||
}
|
}
|
||||||
return presentCite;
|
return presentCite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _utiliserPresentCite(presentCite, typeRencontre, tmr, postRencontre) {
|
async _utiliserPresentCite(presentCite, typeRencontre, tmr) {
|
||||||
this.currentRencontre = TMRRencontres.getRencontre(typeRencontre);
|
this.currentRencontre = TMRRencontres.getRencontre(typeRencontre);
|
||||||
await TMRRencontres.evaluerForceRencontre(this.currentRencontre);
|
await TMRRencontres.evaluerForceRencontre(this.currentRencontre);
|
||||||
await EffetsDraconiques.presentCites.ouvrirLePresent(this.actor, presentCite);
|
await EffetsDraconiques.presentCites.ouvrirLePresent(this.actor, presentCite);
|
||||||
@ -540,7 +528,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
await this._tentativeMaitrise(rencontreData);
|
await this._tentativeMaitrise(rencontreData);
|
||||||
|
|
||||||
this.maximize();
|
this.maximize();
|
||||||
postRencontre();
|
this.postRencontre(tmr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -611,7 +599,6 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
|
|
||||||
async _resultatMaitriseCaseHumide(rollData) {
|
async _resultatMaitriseCaseHumide(rollData) {
|
||||||
await this.souffleSiEchecTotal(rollData);
|
await this.souffleSiEchecTotal(rollData);
|
||||||
this.toclose = rollData.rolled.isEchec;
|
|
||||||
if (rollData.rolled.isSuccess && rollData.double) {
|
if (rollData.rolled.isSuccess && rollData.double) {
|
||||||
rollData.previous = { rolled: rollData.rolled, ajustements: rollData.ajustements };
|
rollData.previous = { rolled: rollData.rolled, ajustements: rollData.ajustements };
|
||||||
rollData.double = undefined;
|
rollData.double = undefined;
|
||||||
@ -624,7 +611,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.html`, rollData)
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.html`, rollData)
|
||||||
});
|
});
|
||||||
if (rollData.rolled.isEchec) {
|
if (rollData.rolled.isEchec) {
|
||||||
this.close();
|
await this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,8 +721,6 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
if (rollData.rolled.isETotal) {
|
if (rollData.rolled.isETotal) {
|
||||||
rollData.souffle = await this.actor.ajouterSouffle({ chat: false });
|
rollData.souffle = await this.actor.ajouterSouffle({ chat: false });
|
||||||
}
|
}
|
||||||
this.toclose = rollData.rolled.isEchec;
|
|
||||||
|
|
||||||
rollData.poesie = await Poetique.getExtrait();
|
rollData.poesie = await Poetique.getExtrait();
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
|
whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
|
||||||
@ -982,7 +967,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
this.actor.notifyRefreshTMR();
|
this.actor.notifyRefreshTMR();
|
||||||
|
|
||||||
if (deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/...
|
if (deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/...
|
||||||
await this.manageRencontre(tmr, () => this.postRencontre(tmr));
|
await this.manageRencontre(tmr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await this.postRencontre(tmr);
|
await this.postRencontre(tmr);
|
||||||
@ -1002,13 +987,13 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
async postRencontre(tmr) {
|
async postRencontre(tmr) {
|
||||||
if (!(this.viewOnly || this.currentRencontre)) {
|
if (!(this.viewOnly || this.currentRencontre)) {
|
||||||
// TODO: vérifier que la méthode s'arrête en cas de non-maîtrise
|
// TODO: vérifier que la méthode s'arrête en cas de non-maîtrise
|
||||||
await this.manageCaseHumide(tmr);
|
if (!this.descenteTMR) await this.manageCaseHumide(tmr);
|
||||||
await this.conquerirCiteFermee(tmr);
|
if (!this.descenteTMR) await this.conquerirCiteFermee(tmr);
|
||||||
await this.purifierPeriple(tmr);
|
if (!this.descenteTMR) await this.purifierPeriple(tmr);
|
||||||
await this.conquerirTMR(tmr);
|
if (!this.descenteTMR) await this.conquerirTMR(tmr);
|
||||||
await this.validerVisite(tmr);
|
if (!this.descenteTMR) await this.validerVisite(tmr);
|
||||||
await this.declencheSortEnReserve(tmr.coord);
|
if (!this.descenteTMR) await this.declencheSortEnReserve(tmr.coord);
|
||||||
await this.actor.checkSoufflePeage(tmr);
|
if (!this.descenteTMR) await this.actor.checkSoufflePeage(tmr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
export class RdDTMRRencontreDialog extends Dialog {
|
export class RdDTMRRencontreDialog extends Dialog {
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
constructor(html, tmrApp, rencontre, postRencontre) {
|
constructor(tmrApp, rencontre, postRencontre) {
|
||||||
const dialogConf = {
|
const dialogConf = {
|
||||||
title: "Rencontre en TMR!",
|
title: "Rencontre en TMR!",
|
||||||
content: "Vous rencontrez un " + rencontre.name + " de force " + rencontre.force + "<br>",
|
content: "Vous rencontrez un " + rencontre.name + " de force " + rencontre.force + "<br>",
|
||||||
|
Loading…
Reference in New Issue
Block a user