fix: persist rollType/actorId on rollBase.options, re-evaluate canReroll after mulligan
Release Creation / build (release) Failing after 2m9s
Release Creation / build (release) Failing after 2m9s
- roll-prompt.mjs: explicitly save rollType, actorId, actorName, actorImage to rollBase.options so mulligan reroll context reads valid values - chat-reaction.mjs: replace canRerollDefense/canRerollAttack = false with recomputation from updated D30 message — aligns same-client with cross-client behavior (new D30 always takes effect, mulligan chain loops)
This commit is contained in:
@@ -549,7 +549,6 @@ Hooks.on("createChatMessage", async (message) => {
|
||||
if (choice === "rerollDefense" && canRerollDefense) {
|
||||
const oldDefenseRoll = defenseRoll
|
||||
const reroll = await LethalFantasyUtils.rerollConfiguredRoll(defenseRerollContext)
|
||||
canRerollDefense = false
|
||||
if (!reroll) continue
|
||||
defenseRoll = reroll.options?.rollTotal || reroll.total || oldDefenseRoll
|
||||
try {
|
||||
@@ -566,12 +565,13 @@ Hooks.on("createChatMessage", async (message) => {
|
||||
} catch(e) {
|
||||
console.error("Mulligan message creation failed (non-fatal):", e)
|
||||
}
|
||||
// Apply new D30 result on the restart
|
||||
// Apply new D30 result on the restart — the new D30 always takes effect,
|
||||
// and if it's another mulligan the reroll button reappears.
|
||||
if (reroll.options?.D30message) {
|
||||
defenseD30message = reroll.options.D30message
|
||||
defenseD30Processed = false
|
||||
}
|
||||
// Restart the full comparison so both sides can react to the new roll
|
||||
canRerollDefense = LethalFantasyUtils.hasD30Reroll(defenseD30message)
|
||||
mulliganRestart = true
|
||||
break
|
||||
}
|
||||
@@ -755,7 +755,6 @@ Hooks.on("createChatMessage", async (message) => {
|
||||
if (choice === "rerollAttack" && canRerollAttack && attackRerollContext) {
|
||||
const oldAttackRoll = attackRollFinal
|
||||
const reroll = await LethalFantasyUtils.rerollConfiguredRoll(attackRerollContext)
|
||||
canRerollAttack = false
|
||||
if (!reroll) continue
|
||||
attackRollFinal = reroll.options?.rollTotal || reroll.total || oldAttackRoll
|
||||
try {
|
||||
@@ -772,14 +771,14 @@ Hooks.on("createChatMessage", async (message) => {
|
||||
} catch(e) {
|
||||
console.error("Mulligan message creation failed (non-fatal):", e)
|
||||
}
|
||||
// Apply new D30 result on the restart
|
||||
// Apply new D30 result on the restart — the new D30 always takes effect,
|
||||
// and if it's another mulligan the reroll button reappears.
|
||||
if (reroll.options?.D30message) {
|
||||
attackD30message = reroll.options.D30message
|
||||
attackD30Processed = false
|
||||
// Invalidate pre-computed effects — the new D30 message must be processed fresh
|
||||
d30AttackPrecomputedStale = true
|
||||
}
|
||||
// Restart the full comparison so both sides can react to the new roll
|
||||
canRerollAttack = LethalFantasyUtils.hasD30Reroll(attackD30message)
|
||||
mulliganRestart = true
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user