mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
new style for dialog roll and remove console.log debuggers (#272)
* new style for dialog roll and remove console.log debuggers * enhance advantage logic
This commit is contained in:
parent
0add5f369e
commit
41181f19f1
50 changed files with 682 additions and 233 deletions
|
|
@ -30,7 +30,7 @@ export default class CostSelectionDialog extends HandlebarsApplicationMixin(Appl
|
|||
static PARTS = {
|
||||
costSelection: {
|
||||
id: 'costSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/costSelection.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
id: 'roll-selection',
|
||||
classes: ['daggerheart', 'views', 'roll-selection'],
|
||||
classes: ['daggerheart', 'dialog', 'dh-style', 'views', 'roll-selection'],
|
||||
position: {
|
||||
width: 400,
|
||||
height: 'auto'
|
||||
width: 550
|
||||
},
|
||||
window: {
|
||||
icon: 'fa-solid fa-dice'
|
||||
},
|
||||
actions: {
|
||||
updateIsAdvantage: this.updateIsAdvantage,
|
||||
|
|
@ -37,20 +39,29 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
}
|
||||
};
|
||||
|
||||
get title() {
|
||||
return this.config.title;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
costSelection: {
|
||||
id: 'costSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/costSelection.hbs'
|
||||
header: {
|
||||
id: 'header',
|
||||
template: 'systems/daggerheart/templates/dialogs/dice-roll/header.hbs'
|
||||
},
|
||||
rollSelection: {
|
||||
id: 'rollSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/rollSelection.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/dice-roll/rollSelection.hbs'
|
||||
},
|
||||
costSelection: {
|
||||
id: 'costSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.rollConfig = this.config;
|
||||
context.hasRoll = !!this.config.roll;
|
||||
context.roll = this.roll;
|
||||
context.rollType = this.roll?.constructor.name;
|
||||
|
|
@ -60,6 +71,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
}));
|
||||
context.selectedExperiences = this.config.experiences;
|
||||
context.advantage = this.config.roll?.advantage;
|
||||
context.disadvantage = this.config.roll?.disadvantage;
|
||||
context.diceOptions = CONFIG.DH.GENERAL.diceTypes;
|
||||
context.canRoll = true;
|
||||
context.isLite = this.config.roll?.lite;
|
||||
|
|
@ -75,7 +87,6 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
}
|
||||
context.extraFormula = this.config.extraFormula;
|
||||
context.formula = this.roll.constructFormula(this.config);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +107,9 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
|
||||
static updateIsAdvantage(_, button) {
|
||||
const advantage = Number(button.dataset.advantage);
|
||||
this.advantage = advantage === 1;
|
||||
this.disadvantage = advantage === -1;
|
||||
|
||||
this.config.roll.advantage = this.config.roll.advantage === advantage ? 0 : advantage;
|
||||
this.render();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
|
|||
static PARTS = {
|
||||
damageSelection: {
|
||||
id: 'damageSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/damageSelection.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/dice-roll/damageSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export default class DamageSelectionDialog extends HandlebarsApplicationMixin(Ap
|
|||
static PARTS = {
|
||||
damageSelection: {
|
||||
id: 'damageSelection',
|
||||
template: 'systems/daggerheart/templates/dialogs/damageSelection.hbs'
|
||||
template: 'systems/daggerheart/templates/dialogs/dice-roll/damageSelection.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue