mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
* Fix action for items * Cost & Range #1 * remove log * actions * Split methods * Roll classes * Begin damage * g * Actions * before main merge * Fix d20RollDialog costs check * Fix submit on close * Add uses in action dialog * Adversary Attack * 166 - Damage Reduction (#180) * Temp * Fixed Stress Reductions * Changed from index based to object * Fixed stress resources management for DamageReduction * Fix Adversary attack multiplier * Auto add Attack action to newly created weapon * Few fixes * 164 - Add Hope/Fear formula * 163 - Actor Sub Datas (#182) * Added rules/bonuses for all classes and subclasses * More * Add Save * Fix delete action button --------- Co-authored-by: WBHarry <williambjrklund@gmail.com> Co-authored-by: WBHarry <89362246+WBHarry@users.noreply.github.com>
59 lines
No EOL
1.6 KiB
JavaScript
59 lines
No EOL
1.6 KiB
JavaScript
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
|
|
|
export default class DamageDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|
constructor(config={}, options={}) {
|
|
super(options);
|
|
|
|
this.config = config;
|
|
}
|
|
|
|
static DEFAULT_OPTIONS = {
|
|
tag: 'form',
|
|
id: 'roll-selection',
|
|
classes: ['daggerheart', 'views', 'damage-selection'],
|
|
position: {
|
|
width: 400,
|
|
height: 'auto'
|
|
},
|
|
actions: {
|
|
submitRoll: this.submitRoll
|
|
},
|
|
form: {
|
|
handler: this.updateRollConfiguration,
|
|
submitOnChange: true,
|
|
submitOnClose: false
|
|
}
|
|
};
|
|
|
|
/** @override */
|
|
static PARTS = {
|
|
damageSelection: {
|
|
id: 'damageSelection',
|
|
template: 'systems/daggerheart/templates/views/damageSelection.hbs'
|
|
}
|
|
};
|
|
|
|
async _prepareContext(_options) {
|
|
const context = await super._prepareContext(_options);
|
|
context.title = this.config.title;
|
|
context.formula = this.config.formula;
|
|
return context;
|
|
}
|
|
|
|
static async submitRoll() {
|
|
await this.close({ submitted: true });
|
|
}
|
|
|
|
/** @override */
|
|
_onClose(options={}) {
|
|
if ( !options.submitted ) this.config = false;
|
|
}
|
|
|
|
static async configure(config={}) {
|
|
return new Promise(resolve => {
|
|
const app = new this(config);
|
|
app.addEventListener("close", () => resolve(app.config), { once: true });
|
|
app.render({ force: true });
|
|
});
|
|
}
|
|
} |