#164 : une seule fenêtre de jet autorisée

This commit is contained in:
sladecraven 2021-02-26 23:54:17 +01:00
parent 74a7b2c0ad
commit 89d66c1347
3 changed files with 20 additions and 2 deletions

View File

@ -112,6 +112,16 @@ export class RdDActor extends Actor {
if (actorData.type === 'vehicule') this._prepareVehiculeData(actorData);
}
/* -------------------------------------------- */
setRollWindowsOpened( flag ) {
this.rollWindowsOpened = flag;
}
/* -------------------------------------------- */
isRollWindowsOpened( ) {
return this.rollWindowsOpened;
}
/* -------------------------------------------- */
_prepareCreatureData(actorData) {
this.computeEncombrementTotalEtMalusArmure();

View File

@ -18,6 +18,12 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */
static async create(actor, rollData, dialogConfig, ...actions) {
if (actor.isRollWindowsOpened() ) {
ui.notifications.warn("Vous avez déja une fenêtre de Test ouverte, il faut la fermer avant d'en ouvrir une autre.")
return;
}
actor.setRollWindowsOpened(true);
RdDRoll._ensureCorrectActions(actions);
RdDRoll._setDefaultOptions(actor, rollData);
@ -102,6 +108,7 @@ export class RdDRoll extends Dialog {
close() {
if (this.rollData.canClose) {
this.actor.setRollWindowsOpened(false);
return super.close();
}
ui.notifications.info("Vous devez faire ce jet de dés!");
@ -112,7 +119,8 @@ export class RdDRoll extends Dialog {
async onAction(action, html) {
await RdDResolutionTable.rollData(this.rollData);
console.log("RdDRoll -=>", this.rollData, this.rollData.rolled);
this.actor.setRollWindowsOpened(false);
if (action.callbacks)
for (let callback of action.callbacks) {
if (callback.condition == undefined || callback.condition(this.rollData)) {

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.3.23",
"version": "1.3.24",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9",