mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 12:41:07 +01:00
.
This commit is contained in:
parent
de9a66e1bc
commit
38868fdab6
23 changed files with 86 additions and 104 deletions
|
|
@ -59,9 +59,7 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
|
|||
? 'DAGGERHEART.UI.Countdowns.decreasingLoop'
|
||||
: 'DAGGERHEART.UI.Countdowns.loop'
|
||||
: null;
|
||||
const randomizeValid = Roll.parse(countdown.progress.startFormula ?? '').some(
|
||||
x => x instanceof foundry.dice.terms.Die
|
||||
);
|
||||
const randomizeValid = !new Roll(countdown.progress.startFormula ?? '').isDeterministic;
|
||||
acc[key] = {
|
||||
...countdown,
|
||||
typeName: game.i18n.localize(CONFIG.DH.GENERAL.countdownBaseTypes[countdown.type].label),
|
||||
|
|
@ -208,17 +206,15 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
|
|||
const countdown = this.data.countdowns[button.dataset.countdownId];
|
||||
const roll = await new Roll(countdown.progress.startFormula).roll();
|
||||
const message = await roll.toMessage({ title: 'Countdown' });
|
||||
const update = async () => {
|
||||
await this.updateSetting({
|
||||
[`countdowns.${button.dataset.countdownId}.progress`]: {
|
||||
start: roll.total,
|
||||
current: this.getMatchingCurrentValue(countdown, roll.total, countdown.progress.current)
|
||||
}
|
||||
});
|
||||
this.render();
|
||||
};
|
||||
|
||||
waitForDiceSoNice(message, update);
|
||||
await waitForDiceSoNice(message);
|
||||
await this.updateSetting({
|
||||
[`countdowns.${button.dataset.countdownId}.progress`]: {
|
||||
start: roll.total,
|
||||
current: this.getMatchingCurrentValue(countdown, roll.total, countdown.progress.current)
|
||||
}
|
||||
});
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async #removeCountdown(event, button) {
|
||||
|
|
|
|||
|
|
@ -200,20 +200,16 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
|
|||
? Math.max(Number(progressMax) - 1, 0)
|
||||
: progressMax;
|
||||
|
||||
const update = async () => {
|
||||
await settings.updateSource({
|
||||
[`countdowns.${target.id}.progress`]: {
|
||||
current: newMax,
|
||||
start: newMax
|
||||
}
|
||||
});
|
||||
await emitAsGM(GMUpdateEvent.UpdateCountdowns, DhCountdowns.gmSetSetting.bind(settings), settings, null, {
|
||||
refreshType: RefreshType.Countdown
|
||||
});
|
||||
};
|
||||
|
||||
if (message) waitForDiceSoNice(message, update);
|
||||
else update();
|
||||
await waitForDiceSoNice(message);
|
||||
await settings.updateSource({
|
||||
[`countdowns.${target.id}.progress`]: {
|
||||
current: newMax,
|
||||
start: newMax
|
||||
}
|
||||
});
|
||||
await emitAsGM(GMUpdateEvent.UpdateCountdowns, DhCountdowns.gmSetSetting.bind(settings), settings, null, {
|
||||
refreshType: RefreshType.Countdown
|
||||
});
|
||||
}
|
||||
|
||||
static async editCountdown(increase, target) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue