#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); if (actorData.type === 'vehicule') this._prepareVehiculeData(actorData);
} }
/* -------------------------------------------- */
setRollWindowsOpened( flag ) {
this.rollWindowsOpened = flag;
}
/* -------------------------------------------- */
isRollWindowsOpened( ) {
return this.rollWindowsOpened;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_prepareCreatureData(actorData) { _prepareCreatureData(actorData) {
this.computeEncombrementTotalEtMalusArmure(); this.computeEncombrementTotalEtMalusArmure();

View File

@ -18,6 +18,12 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async create(actor, rollData, dialogConfig, ...actions) { 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._ensureCorrectActions(actions);
RdDRoll._setDefaultOptions(actor, rollData); RdDRoll._setDefaultOptions(actor, rollData);
@ -102,6 +108,7 @@ export class RdDRoll extends Dialog {
close() { close() {
if (this.rollData.canClose) { if (this.rollData.canClose) {
this.actor.setRollWindowsOpened(false);
return super.close(); return super.close();
} }
ui.notifications.info("Vous devez faire ce jet de dés!"); ui.notifications.info("Vous devez faire ce jet de dés!");
@ -112,7 +119,8 @@ export class RdDRoll extends Dialog {
async onAction(action, html) { async onAction(action, html) {
await RdDResolutionTable.rollData(this.rollData); await RdDResolutionTable.rollData(this.rollData);
console.log("RdDRoll -=>", this.rollData, this.rollData.rolled); console.log("RdDRoll -=>", this.rollData, this.rollData.rolled);
this.actor.setRollWindowsOpened(false);
if (action.callbacks) if (action.callbacks)
for (let callback of action.callbacks) { for (let callback of action.callbacks) {
if (callback.condition == undefined || callback.condition(this.rollData)) { if (callback.condition == undefined || callback.condition(this.rollData)) {

View File

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