Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5734f3a5e3 | |||
| 7675c47ff9 |
@@ -7,8 +7,10 @@ export default class LethalFantasyActor extends Actor {
|
||||
if (data instanceof Array) {
|
||||
return super.create(data, options);
|
||||
}
|
||||
// If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic
|
||||
if (data.items) {
|
||||
// If the created actor already has items (duplicated or imported) bypass the new actor creation logic.
|
||||
// Use .length check because Foundry V2 initializes data.items as an empty array by default
|
||||
// (truthy), which would incorrectly skip the layperson skill auto-population.
|
||||
if (data.items?.length > 0) {
|
||||
let actor = super.create(data, options);
|
||||
return actor;
|
||||
}
|
||||
|
||||
@@ -570,6 +570,10 @@ export async function prompt(options = {}) {
|
||||
rollBase.options.D30result = options.D30result
|
||||
rollBase.options.D30message = options.D30message
|
||||
rollBase.options.badResult = badResult
|
||||
rollBase.options.rollType = options.rollType
|
||||
rollBase.options.actorId = options.actorId
|
||||
rollBase.options.actorName = options.actorName
|
||||
rollBase.options.actorImage = options.actorImage
|
||||
rollBase.options.rollData = foundry.utils.duplicate(rollData)
|
||||
rollBase.options.defenderId = options.defenderId
|
||||
rollBase.options.defenderTokenId = options.defenderTokenId
|
||||
|
||||
@@ -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