FIx for spells/miracles

This commit is contained in:
2026-04-30 23:08:23 +02:00
parent b4211c121d
commit 1641be6516
6 changed files with 50 additions and 15 deletions
+12 -3
View File
@@ -6,9 +6,10 @@ export default class OathHammerMiracleDialog {
const sys = miracle.system
const actorSys = actor.system
const wpRank = actorSys.attributes.willpower.rank
const magicRank = actorSys.skills.magic.rank
const basePool = wpRank + magicRank
const wpRank = actorSys.attributes.willpower.rank
const magicRank = actorSys.skills.magic.rank
const magicColor = actorSys.skills.magic.colorDiceType ?? "white"
const basePool = wpRank + magicRank
const isRitual = sys.isRitual
const dv = isRitual ? (sys.difficultyValue || 1) : null
@@ -18,6 +19,12 @@ export default class OathHammerMiracleDialog {
return key ? game.i18n.localize(key) : sys.divineTradition
})()
const colorOptions = [
{ value: "white", label: game.i18n.localize("OATHHAMMER.ColorDice.White"), selected: magicColor === "white" },
{ value: "red", label: game.i18n.localize("OATHHAMMER.ColorDice.Red"), selected: magicColor === "red" },
{ value: "black", label: game.i18n.localize("OATHHAMMER.ColorDice.Black"), selected: magicColor === "black" },
]
// Miracle count options — DV = miracle number today
const miracleCountOptions = Array.from({ length: 10 }, (_, i) => ({
value: i + 1,
@@ -55,6 +62,7 @@ export default class OathHammerMiracleDialog {
magicRank,
basePool,
miracleCountOptions,
colorOptions,
bonusOptions,
availableLuck,
isHuman,
@@ -93,6 +101,7 @@ export default class OathHammerMiracleDialog {
return {
dv: computedDV,
isRitual,
colorOverride: result.colorOverride ?? magicColor,
bonus: parseInt(result.bonus) || 0,
visibility: result.visibility ?? game.settings.get("core", "rollMode"),
explodeOn5: result.explodeOn5 === "true",
+12 -3
View File
@@ -25,9 +25,10 @@ export default class OathHammerSpellDialog {
const sys = spell.system
const actorSys = actor.system
const intRank = actorSys.attributes.intelligence.rank
const magicRank = actorSys.skills.magic.rank
const basePool = intRank + magicRank
const intRank = actorSys.attributes.intelligence.rank
const magicRank = actorSys.skills.magic.rank
const magicColor = actorSys.skills.magic.colorDiceType ?? "white"
const basePool = intRank + magicRank
const currentStress = actorSys.arcaneStress.value
const stressThreshold = actorSys.arcaneStress.threshold
@@ -41,6 +42,12 @@ export default class OathHammerSpellDialog {
return entry ? game.i18n.localize(entry.label) : (sys.tradition ?? "")
})()
const colorOptions = [
{ value: "white", label: game.i18n.localize("OATHHAMMER.ColorDice.White"), selected: magicColor === "white" },
{ value: "red", label: game.i18n.localize("OATHHAMMER.ColorDice.Red"), selected: magicColor === "red" },
{ value: "black", label: game.i18n.localize("OATHHAMMER.ColorDice.Black"), selected: magicColor === "black" },
]
const enhancementOptions = Object.entries(SPELL_ENHANCEMENTS).map(([key, def]) => ({
value: key,
label: game.i18n.localize(def.label),
@@ -87,6 +94,7 @@ export default class OathHammerSpellDialog {
magicRank,
basePool,
poolSizeOptions,
colorOptions,
currentStress,
stressThreshold,
isOverThreshold,
@@ -134,6 +142,7 @@ export default class OathHammerSpellDialog {
poolPenalty: enh.penalty,
redDice: enh.redDice,
noStress: enh.noStress,
colorOverride: result.colorOverride ?? magicColor,
elementalBonus: parseInt(result.elementalBonus) || 0,
bonus: parseInt(result.bonus) || 0,
poolSize: Math.min(Math.max(1, parseInt(result.poolSize) || basePool), basePool),