Fix actions again
All checks were successful
Release Creation / build (release) Successful in 58s

This commit is contained in:
2025-04-22 08:42:01 +02:00
parent 4b087fc9d8
commit d961e130e0
30 changed files with 178 additions and 169 deletions

View File

@ -221,8 +221,8 @@ export default class LethalFantasyRoll extends Roll {
hasChangeDice = false
options.rollTarget.value = options.rollTarget.actorModifiers.levelSpellModifier + options.rollTarget.actorModifiers.intSpellModifier
options.rollTarget.charModifier = options.rollTarget.actorModifiers.intSpellModifier
hasStaticModifier = true // options.rollType === "spell-power"
hasModifier = true //options.rollType !== "spell-attack"
hasStaticModifier = options.rollType === "spell-power"
hasModifier = options.rollType !== "spell-attack"
options.rollTarget.staticModifier = options.rollTarget.actorLevel
} else if (options.rollType === "miracle" || options.rollType === "miracle-attack" || options.rollType === "miracle-power") {
@ -234,8 +234,8 @@ export default class LethalFantasyRoll extends Roll {
hasChangeDice = false
options.rollTarget.value = options.rollTarget.actorModifiers.levelMiracleModifier + options.rollTarget.actorModifiers.chaMiracleModifier
options.rollTarget.charModifier = options.rollTarget.actorModifiers.chaMiracleModifier
hasStaticModifier = true // options.rollType === "spell-power"
hasModifier = true // options.rollType !== "miracle-attack"
hasStaticModifier = options.rollType === "spell-power"
hasModifier = options.rollType !== "miracle-attack"
options.rollTarget.staticModifier = options.rollTarget.actorLevel
} else if (options.rollType === "shield-roll") {
@ -302,6 +302,7 @@ export default class LethalFantasyRoll extends Roll {
rollType: options.rollType,
rollTarget: options.rollTarget,
rollName: options.rollName,
actorName: options.actorName,
rollModes,
hasModifier,
hasFavor,
@ -373,7 +374,7 @@ export default class LethalFantasyRoll extends Roll {
if (hasStaticModifier) {
modifierFormula += ` + ${options.rollTarget.staticModifier}`
}
modifierFormula += ` + ${options.rollTarget.charModifier}`
// modifierFormula += ` + ${options.rollTarget.charModifier}`
let sign = fullModifier < 0 ? "-" : "+"
if (hasExplode) {
titleFormula = `${dice}E ${sign} ${modifierFormula}`
@ -543,6 +544,7 @@ export default class LethalFantasyRoll extends Roll {
return rollBase
}
/* ***********************************************************/
static async promptInitiative(options = {}) {
const rollModes = Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
const fieldRollMode = new foundry.data.fields.StringField({
@ -603,6 +605,7 @@ export default class LethalFantasyRoll extends Roll {
}
/* ***********************************************************/
static async promptCombatAction(options = {}) {
const rollModes = Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
@ -641,22 +644,22 @@ export default class LethalFantasyRoll extends Roll {
})
} else if (currentAction.type === "spell" || currentAction.type === "miracle") {
let label = ""
if ( currentAction.spellStatus === "castingTime") {
if (currentAction.spellStatus === "castingTime") {
label = "Wait casting time"
}
if ( currentAction.spellStatus === "toBeCasted") {
if (currentAction.spellStatus === "toBeCasted") {
label = "Cast spell/miracle"
}
if ( currentAction.spellStatus === "lethargy") {
if (currentAction.spellStatus === "lethargy") {
label = "Roll lethargy dice"
}
buttons.push({
action: "roll",
label: label,
callback: (event, button, dialog) => {
return "rollLethargyDice"
},
})
action: "roll",
label: label,
callback: (event, button, dialog) => {
return "rollLethargyDice"
},
})
}
} else {
buttons.push({
@ -731,8 +734,8 @@ export default class LethalFantasyRoll extends Roll {
if (currentAction) {
if (rollContext === "rollLethargyDice") {
if ( currentAction.spellStatus === "castingTime") {
if ( currentAction.castingTime < currentAction.system.castingTime) {
if (currentAction.spellStatus === "castingTime") {
if (currentAction.castingTime < currentAction.system.castingTime) {
let message = `Casting time : ${currentAction.name}, count : ${currentAction.castingTime}/${currentAction.system.castingTime}`
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
currentAction.castingTime += 1
@ -747,8 +750,8 @@ export default class LethalFantasyRoll extends Roll {
return
}
}
if ( currentAction.spellStatus === "toBeCasted") {
combatant.actor.prepareRoll( (currentAction.type === "spell") ? "spell-attack" : "miracle-attack" , currentAction._id)
if (currentAction.spellStatus === "toBeCasted") {
combatant.actor.prepareRoll((currentAction.type === "spell") ? "spell-attack" : "miracle-attack", currentAction._id)
if (currentAction.type === "spell") {
currentAction.spellStatus = "lethargy"
await combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction))
@ -758,7 +761,7 @@ export default class LethalFantasyRoll extends Roll {
}
return
}
if ( currentAction.spellStatus === "lethargy") {
if (currentAction.spellStatus === "lethargy") {
// Roll lethargy dice
let dice = LethalFantasyUtils.getLethargyDice(currentAction.system.level)
let roll = new Roll(dice)
@ -772,7 +775,7 @@ export default class LethalFantasyRoll extends Roll {
// Update the combatant progression count
await combatant.setFlag(SYSTEM.id, "currentAction", "")
// Display the action selection window again
combatant.actor.system.rollProgressionDice(options.combatId, options.combatantId )
combatant.actor.system.rollProgressionDice(options.combatId, options.combatantId)
} else {
// Notify that the player cannot act now with a chat message
currentAction.progressionCount += 1
@ -839,7 +842,7 @@ export default class LethalFantasyRoll extends Roll {
}
}
/* ***********************************************************/
static async promptProgressionDice(options = {}) {
const rollModes = Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))
@ -1011,6 +1014,7 @@ export default class LethalFantasyRoll extends Roll {
}
}
/* ***********************************************************/
static async promptRangedDefense(rollTarget) {
const rollModes = Object.fromEntries(Object.entries(CONFIG.Dice.rollModes).map(([key, value]) => [key, game.i18n.localize(value)]))