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
+8 -7
View File
@@ -468,6 +468,7 @@ export async function rollSpellCast(actor, spell, options = {}) {
poolPenalty = 0,
redDice = false,
noStress = false,
colorOverride = "white",
elementalBonus = 0,
bonus = 0,
poolSize = null,
@@ -489,8 +490,8 @@ export async function rollSpellCast(actor, spell, options = {}) {
const totalDice = poolSize !== null
? Math.max(1, Math.min(poolSize + bonus + poolPenalty + elementalBonus + grimPenalty + (luckSpend * luckDicePerPoint), baseDice))
: Math.max(baseDice, 1)
const threshold = redDice ? 3 : 4
const colorEmoji = redDice ? "🔴" : "⬜"
const threshold = colorOverride === "black" ? 2 : colorOverride === "red" ? 3 : 4
const colorEmoji = colorOverride === "black" ? "⬛" : colorOverride === "red" ? "🔴" : "⬜"
const { roll, rolls, successes, diceResults } = await _rollPool(totalDice, threshold, explodeOn5)
const diceHtml = _diceHtml(diceResults, threshold)
@@ -560,13 +561,12 @@ export async function rollSpellCast(actor, spell, options = {}) {
`
const rollMode = visibility ?? game.settings.get("core", "rollMode")
const spellColorType = redDice ? "red" : "white"
const msgData = {
speaker: ChatMessage.getSpeaker({ actor }),
content,
rolls: rolls,
sound: CONFIG.sounds.dice,
flags: { "fvtt-oath-hammer": { luckRoll: _luckFlagData(actor, threshold, spellColorType, dv, false, explodeOn5) } },
flags: { "fvtt-oath-hammer": { luckRoll: _luckFlagData(actor, threshold, colorOverride, dv, false, explodeOn5) } },
}
ChatMessage.applyRollMode(msgData, rollMode)
await ChatMessage.create(msgData)
@@ -590,6 +590,7 @@ export async function rollMiracleCast(actor, miracle, options = {}) {
const {
dv = 1,
isRitual = false,
colorOverride = "white",
bonus = 0,
visibility,
explodeOn5 = false,
@@ -604,8 +605,8 @@ export async function rollMiracleCast(actor, miracle, options = {}) {
const magicRank = actorSys.skills.magic.rank
const luckDicePerPoint = luckIsHuman ? 3 : 2
const totalDice = Math.max(wpRank + magicRank + bonus + (luckSpend * luckDicePerPoint), 1)
const threshold = 4
const colorEmoji = "⬜"
const threshold = colorOverride === "black" ? 2 : colorOverride === "red" ? 3 : 4
const colorEmoji = colorOverride === "black" ? "⬛" : colorOverride === "red" ? "🔴" : "⬜"
const { roll, rolls, successes, diceResults } = await _rollPool(totalDice, threshold, explodeOn5)
const diceHtml = _diceHtml(diceResults, threshold)
@@ -664,7 +665,7 @@ export async function rollMiracleCast(actor, miracle, options = {}) {
content,
rolls: rolls,
sound: CONFIG.sounds.dice,
flags: { "fvtt-oath-hammer": { luckRoll: _luckFlagData(actor, threshold, "white", dv, false, explodeOn5) } },
flags: { "fvtt-oath-hammer": { luckRoll: _luckFlagData(actor, threshold, colorOverride, dv, false, explodeOn5) } },
}
ChatMessage.applyRollMode(msgData, rollMode)
await ChatMessage.create(msgData)