Gestion de la mise en reserve
This commit is contained in:
parent
0fecc3a202
commit
dc57b46db5
@ -210,19 +210,23 @@ export class RdDActor extends Actor {
|
||||
if (myReve.value < 0) myReve.value = 0;
|
||||
await this.update( {"data.reve.reve": myReve } );
|
||||
specialStr += "<br>Réussite du sort pour " + costReve + " Points de Rêve";
|
||||
if ( !rollData.isSortReserve)
|
||||
this.currentTMR.close(); // Close TMR !
|
||||
} else {
|
||||
if ( rollData.pointsDeTache == -4) { // Echec total !
|
||||
costReve *= 2;
|
||||
myReve.value = myReve.value - costReve; // Todo 0 pts de reve !!!!
|
||||
if (myReve.value < 0) myReve.value = 0;
|
||||
await this.update( {"data.reve.reve": myReve } );
|
||||
specialStr += "<br><strong>Echec TOTAL</strong> du sort !, pour " + costReve + " Points de Rêve";
|
||||
specialStr += "<br><strong>Echec TOTAL</strong> du sort : " + costReve + " Points de Rêve";
|
||||
} else {
|
||||
specialStr += "<br>Echec du sort !";
|
||||
}
|
||||
this.currentTMR.close(); // Close TMR !
|
||||
}
|
||||
if (myReve.value == 0) { // 0 points de reve
|
||||
ChatMessage.create( {title: "Zero Points de Reve !", content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" } );
|
||||
this.currentTMR.close(); // Close TMR !
|
||||
}
|
||||
} else {
|
||||
lvl = (rollData.competence) ? rollData.competence.name : rollData.bmValue;
|
||||
@ -464,20 +468,19 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollUnSort( coord ) {
|
||||
console.log("Lancer de sort !!!!!");
|
||||
let draconicList = this.getDraconicList();
|
||||
let sortList = this.getSortList();
|
||||
|
||||
let rollData = {
|
||||
"selectedCarac": this.data.data.carac.reve,
|
||||
"etat": this.data.data.compteurs.etat.value,
|
||||
"draconicList": draconicList,
|
||||
"sortList": sortList,
|
||||
"selectedDraconic": draconicList[0],
|
||||
"selectedSort": sortList[0],
|
||||
"coord": coord,
|
||||
"finalLevel": 0,
|
||||
"bmValue": 0
|
||||
selectedCarac: this.data.data.carac.reve,
|
||||
etat: this.data.data.compteurs.etat.value,
|
||||
draconicList: draconicList,
|
||||
sortList: sortList,
|
||||
selectedDraconic: draconicList[0],
|
||||
selectedSort: sortList[0],
|
||||
coord: coord,
|
||||
finalLevel: 0,
|
||||
bmValue: 0
|
||||
}
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', rollData);
|
||||
new RdDRollDialog("sort", html, rollData, this ).render(true);
|
||||
@ -537,7 +540,8 @@ export class RdDActor extends Actor {
|
||||
isRapide: isRapide
|
||||
}
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', data );
|
||||
new RdDTMRDialog(html, this, data ).render(true);
|
||||
this.currentTMR = new RdDTMRDialog(html, this, data );
|
||||
this.currentTMR.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -7,20 +7,22 @@ export class RdDRollDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(mode, html, rollData, actor) {
|
||||
|
||||
let myButtons = { rollButton: {
|
||||
label: "Lancer",
|
||||
callback: html => this.performRollSort(html, false)
|
||||
} };
|
||||
if (mode == "sort") {
|
||||
myButtons['reserveButton'] = { label: "Mettre en reserve",
|
||||
callback: html => this.performRollSort(html, true)
|
||||
}
|
||||
}
|
||||
|
||||
// Common conf
|
||||
let dialogConf = {
|
||||
content: html,
|
||||
buttons:
|
||||
{
|
||||
rollButton:
|
||||
{
|
||||
label: "Lancer",
|
||||
callback: html => this.performRoll(html)
|
||||
}
|
||||
},
|
||||
default: "rollButton"
|
||||
}
|
||||
buttons: myButtons,
|
||||
default: "rollButton"
|
||||
}
|
||||
let dialogOptions = { classes: [ "rdddialog"] }
|
||||
|
||||
// Select proper roll dialog template and stuff
|
||||
@ -39,7 +41,7 @@ export class RdDRollDialog extends Dialog {
|
||||
} else if (mode == "sort") {
|
||||
dialogConf.title = "Lancer un sort",
|
||||
dialogOptions.width = 600;
|
||||
dialogOptions.height = 360;
|
||||
dialogOptions.height = 380;
|
||||
}
|
||||
super(dialogConf, dialogOptions);
|
||||
|
||||
@ -49,12 +51,12 @@ export class RdDRollDialog extends Dialog {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
performRoll (html) {
|
||||
performRollSort (html, isReserve=false) {
|
||||
this.rollData.isSortReserve = isReserve;
|
||||
this.actor.performRoll( this.rollData );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
|
@ -298,11 +298,6 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
lancerSort() {
|
||||
this.actor.rollUnSort(this.actor.data.data.reve.tmrpos.coord);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async activateListeners(html) {
|
||||
@ -314,7 +309,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
// Roll Sort
|
||||
html.find('#lancer-sort').click((event) => {
|
||||
this.lancerSort();
|
||||
this.actor.rollUnSort(this.actor.data.data.reve.tmrpos.coord);
|
||||
});
|
||||
|
||||
// load the texture we need
|
||||
@ -351,7 +346,6 @@ export class RdDTMRDialog extends Dialog {
|
||||
this.updateValuesDisplay();
|
||||
let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);
|
||||
this.manageRencontre( this.actor.data.data.reve.tmrpos.coord,cellDescr );
|
||||
this.manageCaseHumide( cellDescr );
|
||||
|
||||
this.manageCaseHumide( cellDescr );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user