displays ZfW based on selected Mods and its initial Spell Value

pull/67/head
macniel 2025-11-26 19:03:52 +01:00
parent 957584206d
commit 5f85631679
2 changed files with 19 additions and 3 deletions

View File

@ -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 === "*") {

View File

@ -27,9 +27,9 @@
</div>
{{#if this.variants}}
<fieldset>
<fieldset class="scroll-y">
<legend>Variante</legend>
<div class="variantList scroll-y">
<div class="variantList">
{{#each this.variants}}
<div class="variant">
<div class="selection">