mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
[Feature] Roll Rules Standardization (#1818)
* Moved default hope/fear/advantage/disadvantage under system/rules/roll and changed them to be dice indexs * . * . * .
This commit is contained in:
parent
7af3f07a26
commit
2c994ac78c
15 changed files with 132 additions and 83 deletions
|
|
@ -176,11 +176,11 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
|
||||
this.config.roll.advantage = this.config.roll.advantage === advantage ? 0 : advantage;
|
||||
|
||||
if (this.config.roll.advantage === 1 && this.config.data.rules.roll.defaultAdvantageDice) {
|
||||
const faces = Number.parseInt(this.config.data.rules.roll.defaultAdvantageDice);
|
||||
if (this.config.roll.advantage === 1 && this.config.data.rules.roll.advantageFaces) {
|
||||
const faces = Number.parseInt(this.config.data.rules.roll.advantageFaces);
|
||||
this.roll.advantageFaces = Number.isNaN(faces) ? this.roll.advantageFaces : faces;
|
||||
} else if (this.config.roll.advantage === -1 && this.config.data.rules.roll.defaultDisadvantageDice) {
|
||||
const faces = Number.parseInt(this.config.data.rules.roll.defaultDisadvantageDice);
|
||||
} else if (this.config.roll.advantage === -1 && this.config.data.rules.roll.disadvantageFaces) {
|
||||
const faces = Number.parseInt(this.config.data.rules.roll.disadvantageFaces);
|
||||
this.roll.advantageFaces = Number.isNaN(faces) ? this.roll.advantageFaces : faces;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,23 @@ export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(App
|
|||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.item = this.item;
|
||||
context.fields = this.item.system.schema.fields.levelupOptionTiers.element.element.fields;
|
||||
context.item = this.item;
|
||||
context.levelupOptionTiers = Object.keys(this.item.system.levelupOptionTiers).reduce((acc, key) => {
|
||||
const tier = this.item.system.levelupOptionTiers[key];
|
||||
acc[key] = Object.keys(tier).reduce((acc, key) => {
|
||||
const option = tier[key];
|
||||
acc[key] = {
|
||||
...option,
|
||||
typeData: option.type ? LevelOptionType[option.type] : null
|
||||
};
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return acc;
|
||||
}, {})
|
||||
|
||||
context.optionTypes = LevelOptionType;
|
||||
context.selectedOption = this.selectedOption;
|
||||
|
||||
|
|
@ -63,6 +78,7 @@ export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(App
|
|||
|
||||
static async updateData(_event, _element, formData) {
|
||||
const data = foundry.utils.expandObject(formData.object);
|
||||
await this.item.update(data)
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue