Fix lethargy + charaster race
All checks were successful
Release Creation / build (release) Successful in 1m7s

This commit is contained in:
2025-04-06 23:16:30 +02:00
parent b029aba2b6
commit 9035ad4bfb
26 changed files with 105 additions and 89 deletions

View File

@ -672,23 +672,32 @@ export default class LethalFantasyRoll extends Roll {
rangedMode = "focusedAim"
}
if (searchId.match("spellLevel")) {
let spellConfig = SYSTEM.SPELL_LETHARGY_DICE[searchId]
let formula = spellConfig.dice
if (searchId.match("spell")) {
searchId = searchId.replace("spell", "")
let spell = actor.items.find(i => i.type === "spell" && i.id === searchId)
let dice = LethalFantasyUtils.getLethargyDice(spell.system.level)
if (options.rollProgressionCount <= spell.system.castingTime ) {
let message = `Spell casting time : ${spell.name}, count : ${options.rollProgressionCount}/${spell.system.castingTime}`
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: actor }) })
return
}
let formula = dice
let roll = new Roll(formula)
await roll.evaluate()
let max = roll.dice[0].faces - 1
let toCompare = Math.min(options.rollProgressionCount-spell.system.castingTime, max)
let message
if (options.rollProgressionCount <= roll.total ) {
message = `Spell Lethargy ongoing ... (${roll.total}/${options.rollProgressionCount}, spell level ${spellConfig.level})`
if (roll.total > toCompare) {
message = `Spell Lethargy ongoing ... (${roll.total}/${toCompare}, spell level ${spell.system.level})`
} else {
let combat = game.combats.get(options.combatId)
combat.resetProgression(options.combatantId)
message = `Spell Lethargy ended ! (${roll.total}/${options.rollProgressionCount}, spell level ${spellConfig.level})`
message = `Spell Lethargy ended ! (${roll.total}/${toCompare}, spell level ${spell.system.level})`
}
let msg = await roll.toMessage({ flavor: message }, { rollMode: rollContext.visibility })
if (game?.dice3d) {
await game.dice3d.waitFor3DAnimationByMessageID(msg.id)
}
}
return
}