Fix prayer roll
All checks were successful
Release Creation / build (release) Successful in 45s

This commit is contained in:
2025-04-23 16:05:01 +02:00
parent 16959dd52e
commit ebb7bfe3d6
24 changed files with 84 additions and 74 deletions

View File

@ -743,14 +743,15 @@ export default class LethalFantasyRoll extends Roll {
if (currentAction) {
if (rollContext === "rollLethargyDice") {
if (currentAction.spellStatus === "castingTime") {
if (currentAction.castingTime < currentAction.system.castingTime) {
let message = `Casting time : ${currentAction.name}, count : ${currentAction.castingTime}/${currentAction.system.castingTime}`
let time = currentAction.type === "spell" ? currentAction.system.castingTime : currentAction.system.prayerTime
if (currentAction.castingTime < time) {
let message = `Casting time : ${currentAction.name}, count : ${currentAction.castingTime}/${time}`
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
currentAction.castingTime += 1
await combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction))
return
} else {
let message = `Spell ${currentAction.name} ready to be cast on next second !`
let message = `Spell/Miracle ${currentAction.name} ready to be cast on next second !`
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
currentAction.castingTime = 1
currentAction.spellStatus = "toBeCasted"
@ -890,7 +891,7 @@ export default class LethalFantasyRoll extends Roll {
},
{
action: "cast",
label: "Cast a spell",
label: "Cast a spell/Miracle",
callback: (event, button, dialog) => {
return "casting"
},

View File

@ -298,8 +298,17 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
if (this.biodata.magicUser || this.biodata.clericUser) {
let spells = this.parent.items.filter(i => i.type === "spell" || i.type === "miracle")
for (let s of spells) {
let dice = LethalFantasyUtils.getLethargyDice(s.system.level)
weaponsChoices.push({ id: s.id, name: `${s.name} (Time: ${s.system.castingTime}, Lethargy: ${dice})`, combatProgressionDice: `${s.system.castingTime}+${dice}` })
let title = ""
let formula = ""
if (s.type === "spell") {
let dice = LethalFantasyUtils.getLethargyDice(s.system.level)
title = `${s.name} (Casting time: ${s.system.castingTime}, Lethargy: ${dice})`
formula = `${s.system.castingTime}+${dice}`
} else {
title = `${s.name} (Prayer time: ${s.system.prayerTime})`
formula = `${s.system.prayerTime}`
}
weaponsChoices.push({ id: s.id, name: title, combatProgressionDice: formula })
}
}