diff --git a/src/assets/coins/heller.png b/src/assets/coins/heller.png
index 4c2fffc4..418a9a19 100644
Binary files a/src/assets/coins/heller.png and b/src/assets/coins/heller.png differ
diff --git a/src/lang/de.json b/src/lang/de.json
index 17787b0d..7c84a0e8 100644
--- a/src/lang/de.json
+++ b/src/lang/de.json
@@ -49,7 +49,8 @@
"title": "Zauber kann aus folgenden Gründen nicht gewirkt werden:",
"noRepresentation": "Keine Repräsentation gewählt",
"tooManySpoMods": "Zu viele Spontane Modifikationen ausgewählt",
- "noZFPDataAvailable": "Noch keine Zauberprobe gewürfelt"
+ "noZFPDataAvailable": "Noch keine Zauberprobe gewürfelt",
+ "overspentZFP": "Zu viele ZfP ausgegeben"
}
},
"ITEM_BROWSER": {
diff --git a/src/module/data/spellData/spellData.mjs b/src/module/data/spellData/spellData.mjs
index 1079245a..b862b3ec 100644
--- a/src/module/data/spellData/spellData.mjs
+++ b/src/module/data/spellData/spellData.mjs
@@ -18,6 +18,11 @@ export const leadingAttribute = {
"Zaubertänzer": "IN"
}
+
+/*
+die ohne ZfP Kosten mussen vorher ausgewählt werden
+ */
+
/**
*
* @type {[String: {name: string, description: string, modFn: string, castTimeModFn: string, costModFn: string}]}
diff --git a/src/module/dialog/spellDialog.mjs b/src/module/dialog/spellDialog.mjs
index 8d74ce0e..8ddfe7b8 100644
--- a/src/module/dialog/spellDialog.mjs
+++ b/src/module/dialog/spellDialog.mjs
@@ -76,6 +76,7 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
this.cost = this.normalizeCastingCost() ?? 0
this.castingTime = this.#normalizeCastingTime(this._spell)
this.zfp = null
+ this.zfpDetermined = false
if (this._selectedRepresentation) {
this._costModel = this._spell.system.kosten.find(c => c.repräsentation === context.selectedRepresentation) ?? this._spell.system.kosten.find(c => c.repräsentation === "")
this._castTimeModel = this._spell.system.zauberdauer
@@ -133,7 +134,6 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
this._castTimeMutators = castTimeMutators
-
this.mod = 0
this._activeVariants = Object.entries(this._variants)
.filter(([key, truthiness]) => truthiness)
@@ -253,6 +253,7 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
"3d20",
{
value: this._spell.system.zfw + this.mod,
+ werte: this.#getProbenWerte(),
owner: this._actor
}
)
@@ -268,6 +269,8 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
})
}
this.zfp = result.tap
+
+ this.zfpDetermined = true
this.render({parts: ["form"]})
}
@@ -361,6 +364,28 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
return options
}
+ #getProbenWerte() {
+ let dice = []
+ this._spell.system.probe.map(p => {
+ if (p === "*") {
+ return this._spellDie ?? null
+ } else {
+ return p
+ }
+ }).forEach(p => {
+ if (p !== null) {
+ dice.push(
+ this._actor.system.attribute[p.toLowerCase()].aktuell
+ )
+ } else {
+ dice.push(
+ "??"
+ )
+ }
+ })
+ return dice
+ }
+
async _prepareContext(options) {
const context = await super._prepareContext(options)
@@ -376,6 +401,7 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
context.displayModResult = (context.modResult > 0 ? "+" : "") + context.modResult
context.castingTime = this.castingTime
context.ready = true
+ context.zfpDetermined = this.zfpDetermined
// variable probe (should consider Achaz as they can replace one KL in a KL/KL/* spell with IN
@@ -499,9 +525,34 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
context.ready = false
context.diceRoll = true
} else {
- context.zfp = this.zfp
+ if (this.zfp === 0) {
+ this.zfp = 1
+ }
+ let zfpMod = 0
+
+ Object.entries(this._spoMods).forEach(([modName, times]) => {
+
+ const actualMod = spoModData[modName]
+
+ for (let i = 0; i < times; i++) {
+ const zmfn = new Function("mod", "return " + actualMod.modFn)
+ zfpMod = zmfn(zfpMod)
+ }
+
+ })
+
+ if (this.zfp + zfpMod > this._spell.system.zfw) { // cant be higher than the learnt level
+ context.zfpModified = this._spell.system.zfw
+ } else {
+ context.zfpModified = this.zfp + zfpMod
+ }
+
context.spellName = this._spell.system.name
- context.variant = context.variants.filter(v => v.variantChecked).map(v => v.variantText).join("
")
+ context.variant = context.variants.filter(v => v.variantChecked).map(v => `${v.variantName}—${v.variantText}`).join("
")
+
+ if (context.zfpModified < 0) {
+ context.ready = false
+ }
}
if (!context.ready) { // rules have changed, it cant be cast when zfp - selected mutators is below 0
@@ -511,7 +562,9 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
if (this.zfp == null) {
context.notReadyReasons += `