Fixes nombreux sur tmr

- rencontre sur case humide ne causait pas de maîtrise
- détermination de la liste des tmrs par type à l'init (classify)
- tirages aléatoire par type de tmr dans les commandes
- amélioration de messages (nom de case)
- fix expérience case humide
- correction gestion des débordement
- montées très laborieuses multiples
- renommages et extraits méthodes
- distinction de pos (x, y) vs coord (A1)
This commit is contained in:
Vincent Vandemeulebrouck
2021-02-05 01:38:40 +01:00
parent d53077d862
commit 9fd7db2ccf
11 changed files with 282 additions and 246 deletions

View File

@ -1,22 +1,22 @@
/* -------------------------------------------- */
export class RdDTMRRencontreDialog extends Dialog {
/* -------------------------------------------- */
constructor(html, tmrApp, rencontre) {
constructor(html, tmrApp, rencontre, postRencontre) {
const dialogConf = {
title: "Rencontre en TMR!",
content: "Vous recontrez un " + rencontre.name + " de force " + rencontre.force + "<br>",
buttons: {
derober: { icon: '<i class="fas fa-check"></i>', label: "Se dérober", callback: () => { this.toClose = true; this.tmrApp.derober() } },
refouler: { icon: '<i class="fas fa-check"></i>', label: "Refouler", callback: () => { this.toClose = true; this.tmrApp.refouler() } },
maitiser: { icon: '<i class="fas fa-check"></i>', label: "Maîtriser", callback: () => { this.toClose = true; this.tmrApp.maitriser() } }
derober: { icon: '<i class="fas fa-check"></i>', label: "Se dérober", callback: () => { this.onButtonFuir(() => tmrApp.derober()); } },
refouler: { icon: '<i class="fas fa-check"></i>', label: "Refouler", callback: () => this.onButtonAction(() => tmrApp.refouler()) },
maitiser: { icon: '<i class="fas fa-check"></i>', label: "Maîtriser", callback: () => this.onButtonAction(() => tmrApp.maitriser()) }
},
default: "derober"
}
};
if (rencontre.ignorer) {
dialogConf.buttons.ignorer = { icon: '<i class="fas fa-check"></i>', label: "Ignorer", callback: () => { this.toClose = true; this.tmrApp.ignorerRencontre() }};
}
dialogConf.buttons.ignorer = { icon: '<i class="fas fa-check"></i>', label: "Ignorer", callback: () => this.onButtonAction(() => tmrApp.ignorerRencontre()) }
};
const dialogOptions = {
classes: ["tmrrencdialog"],
width: 320, height: 240,
@ -26,13 +26,25 @@ export class RdDTMRRencontreDialog extends Dialog {
this.toClose = false;
this.rencontreData = duplicate(rencontre);
this.postRencontre = postRencontre;
this.tmrApp = tmrApp;
this.tmrApp.minimize();
}
async onButtonAction(action) {
this.toClose = true;
await action();
this.postRencontre();
}
onButtonFuir(action) {
this.toClose = true;
await action();
}
/* -------------------------------------------- */
close() {
if ( this.toClose ) {
if (this.toClose) {
this.tmrApp.maximize();
return super.close();
}