diff --git a/src/module/dialog/spellDialog.mjs b/src/module/dialog/spellDialog.mjs index c73cd62a..3f99c2e9 100644 --- a/src/module/dialog/spellDialog.mjs +++ b/src/module/dialog/spellDialog.mjs @@ -47,11 +47,13 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) { _mutators = {} _variants = {} _costModel = {} + displayModResult = 0 constructor(actor, spellId) { super() this._actor = actor this._spell = this._actor.itemTypes["Spell"].find(p => p._id === spellId) + this.displayModResult = Number(this._spell.system.zfw) this._circumstance = 0 this._mods = [] this._mutators = {} @@ -107,6 +109,18 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) { this._mutators = mutators } + this.displayModResult = Number(this._spell.system.zfw) + + this._activeVariants = Object.entries(this._variants) + .filter(([key, truthiness]) => truthiness) + .map(([key, truthiness]) => this._spell.system.varianten.find(v => v.name === key)) + this._activeVariants.forEach(variant => { + + if (variant.mod) { + this.displayModResult += Number(variant.mod) + } + + }) this.render({parts: ["form"]}) } @@ -148,7 +162,7 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) { if (options.window) { if (this._spell) { - options.window.title = this._spell.name + options.window.title = `${this._spell.name} [${this._spell.system.zfw}]` } } @@ -166,6 +180,8 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) { context.text = this._spell.system.wirkung context.dice = [] context.colorfulDice = game.settings.get('DSA_4-1', 'optional_colorfuldice') + context.modResult = this.displayModResult + context.displayModResult = (context.modResult > 0 ? "+" : "") + this.displayModResult this._spell.system.probe.map(p => { if (p === "*") { diff --git a/src/templates/dialog/spell-dialog.hbs b/src/templates/dialog/spell-dialog.hbs index f51c170a..12d11e40 100644 --- a/src/templates/dialog/spell-dialog.hbs +++ b/src/templates/dialog/spell-dialog.hbs @@ -27,9 +27,9 @@ {{#if this.variants}} -
+
Variante -
+
{{#each this.variants}}