This commit is contained in:
@@ -72,7 +72,7 @@ export default class LethalFantasyActor extends Actor {
|
||||
/* *************************************************/
|
||||
async applyDamage(hpLoss) {
|
||||
let hp = this.system.hp.value + hpLoss
|
||||
this.update({ "system.hp.value": hp })
|
||||
await this.update({ "system.hp.value": hp })
|
||||
}
|
||||
|
||||
/* *************************************************/
|
||||
@@ -163,7 +163,7 @@ export default class LethalFantasyActor extends Actor {
|
||||
|
||||
/* *************************************************/
|
||||
async prepareRoll(rollType, rollKey, rollDice, defenderId, defenderTokenId, extraShieldDr = 0, d30Effects = {}) {
|
||||
console.log("Preparing roll", rollType, rollKey, rollDice, defenderId)
|
||||
log("Preparing roll", rollType, rollKey, rollDice, defenderId)
|
||||
let rollTarget
|
||||
switch (rollType) {
|
||||
case "granted":
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { log } from "../utils.mjs"
|
||||
|
||||
/**
|
||||
* Classe pour gérer les résultats du D30 dans Lethal Fantasy
|
||||
*/
|
||||
@@ -41,7 +43,7 @@ export default class D30Roll {
|
||||
this.resultsTable = data.d30_dice_results
|
||||
this.definitions = data.definitions
|
||||
|
||||
console.log("D30Roll | D30 results table loaded successfully")
|
||||
log("D30Roll | D30 results table loaded successfully")
|
||||
} catch (error) {
|
||||
console.error("D30Roll | Error loading D30 table:", error)
|
||||
ui.notifications.error("Unable to load D30 results table")
|
||||
|
||||
+22
-22
@@ -392,7 +392,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
{
|
||||
label: label,
|
||||
callback: (event, button, dialog) => {
|
||||
console.log("Roll context", event, button, dialog)
|
||||
log("Roll context", event, button, dialog)
|
||||
let position = dialog?.position
|
||||
game.user.setFlag(SYSTEM.id, "roll-dialog-pos", foundry.utils.duplicate(position))
|
||||
const output = Array.from(button.form.elements).reduce((obj, input) => {
|
||||
@@ -435,7 +435,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
|
||||
// If the user cancels the dialog, exit
|
||||
if (rollContext === null) return
|
||||
console.log("rollContext", rollContext, hasGrantedDice)
|
||||
log("rollContext", rollContext, hasGrantedDice)
|
||||
rollContext.saveSpell = saveSpell // Update fucking flag
|
||||
|
||||
let fullModifier = 0
|
||||
@@ -552,7 +552,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
if (rollContext.favor === "favor") {
|
||||
rollFavor = new this(baseFormula, options.data, rollData)
|
||||
await rollFavor.evaluate()
|
||||
console.log("Rolling with favor", rollFavor)
|
||||
log("Rolling with favor", rollFavor)
|
||||
if (game?.dice3d) {
|
||||
game.dice3d.showForRoll(rollFavor, game.user, true)
|
||||
}
|
||||
@@ -861,12 +861,12 @@ export default class LethalFantasyRoll extends Roll {
|
||||
rejectClose: false // Click on Close button will not launch an error
|
||||
})
|
||||
|
||||
console.log("RollContext", dialogContext, rollContext)
|
||||
log("RollContext", dialogContext, rollContext)
|
||||
// If action is cancelled, exit
|
||||
if (rollContext === null || rollContext === "cancel") {
|
||||
await combatant.setFlag(SYSTEM.id, "currentAction", "")
|
||||
let message = `${combatant.name} : Other action, progression reset`
|
||||
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -924,7 +924,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
// Set the flag on the combatant
|
||||
await combatant.setFlag(SYSTEM.id, "currentAction", actionItem)
|
||||
let message = `${combatant.name} action : ${selectedItem.name}, start rolling progression dice or casting time`
|
||||
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
rollContext = (actionItem.type === "weapon") ? "rollProgressionDice" : "rollLethargyDice" // Set the roll context to rollProgressionDice
|
||||
currentAction = actionItem
|
||||
}
|
||||
@@ -935,14 +935,14 @@ export default class LethalFantasyRoll extends Roll {
|
||||
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 }) })
|
||||
await 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 {
|
||||
// Last counting second — announce ready and transition immediately (no extra second consumed)
|
||||
let message = `Casting time : ${currentAction.name}, count : ${time}/${time} — ready to cast next second !`
|
||||
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
currentAction.castingTime = 1
|
||||
currentAction.spellStatus = "toBeCasted"
|
||||
await combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction))
|
||||
@@ -982,7 +982,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
isLethargy: true
|
||||
}
|
||||
)
|
||||
ChatMessage.create({ content: messageContent, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: messageContent, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
// Update the combatant progression count
|
||||
await combatant.setFlag(SYSTEM.id, "currentAction", "")
|
||||
// Display the action selection window again
|
||||
@@ -1002,7 +1002,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
isLethargy: true
|
||||
}
|
||||
)
|
||||
ChatMessage.create({ content: messageContent, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: messageContent, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1014,18 +1014,18 @@ export default class LethalFantasyRoll extends Roll {
|
||||
let split = toSplit.split("+")
|
||||
currentAction.rangedLoad = Number(split[0]) || 0
|
||||
formula = split[1]
|
||||
console.log("Ranged Mode", currentAction.rangedMode, currentAction.rangedLoad, formula)
|
||||
log("Ranged Mode", currentAction.rangedMode, currentAction.rangedLoad, formula)
|
||||
}
|
||||
// Range weapon loading
|
||||
if (!currentAction.weaponLoaded && currentAction.rangedLoad) {
|
||||
if (currentAction.progressionCount < currentAction.rangedLoad) {
|
||||
let message = `Ranged weapon ${currentAction.name} is loading, loading count : ${currentAction.progressionCount}/${currentAction.rangedLoad}`
|
||||
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
currentAction.progressionCount += 1
|
||||
await combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction))
|
||||
} else {
|
||||
let message = `Ranged weapon ${currentAction.name} is loaded !`
|
||||
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
currentAction.weaponLoaded = true
|
||||
currentAction.progressionCount = 1
|
||||
await combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction))
|
||||
@@ -1057,13 +1057,13 @@ export default class LethalFantasyRoll extends Roll {
|
||||
rollResult: roll.total
|
||||
}
|
||||
)
|
||||
ChatMessage.create({ content: messageContent, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: messageContent, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await combatant.setFlag(SYSTEM.id, "currentAction", "")
|
||||
combatant.actor.prepareRoll(currentAction.type === "weapon" ? "weapon-attack" : "spell-attack", currentAction._id)
|
||||
} else {
|
||||
// Notify that the player cannot act now with a chat message
|
||||
currentAction.progressionCount += 1
|
||||
combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction))
|
||||
await combatant.setFlag(SYSTEM.id, "currentAction", foundry.utils.duplicate(currentAction))
|
||||
const messageContent = await foundry.applications.handlebars.renderTemplate(
|
||||
"systems/fvtt-lethal-fantasy/templates/progression-message.hbs",
|
||||
{
|
||||
@@ -1074,7 +1074,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
progressionCount: currentAction.progressionCount
|
||||
}
|
||||
)
|
||||
ChatMessage.create({ content: messageContent, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
await ChatMessage.create({ content: messageContent, speaker: ChatMessage.getSpeaker({ actor: combatant.actor }) })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1130,7 +1130,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
// If the user cancels the dialog, exit
|
||||
if (rollContext === null) return
|
||||
|
||||
console.log("RollContext", rollContext)
|
||||
log("RollContext", rollContext)
|
||||
// Add disfavor/favor option if point blank range
|
||||
if (rollContext.range === "pointblank") {
|
||||
rollContext.movement = rollContext.movement.replace("kh", "")
|
||||
@@ -1426,7 +1426,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
/** @override */
|
||||
async render(chatOptions = {}) {
|
||||
let chatData = await this._getChatCardData(chatOptions.isPrivate)
|
||||
console.log("ChatData", chatData)
|
||||
log("ChatData", chatData)
|
||||
return await foundry.applications.handlebars.renderTemplate(this.constructor.CHAT_TEMPLATE, chatData)
|
||||
}
|
||||
|
||||
@@ -1464,15 +1464,15 @@ export default class LethalFantasyRoll extends Roll {
|
||||
|
||||
// Récupérer les informations de l'arme pour les attaques réussies
|
||||
let weaponDamageOptions = null
|
||||
console.log("Roll type:", this.type, "rollTarget:", this.rollTarget, "Has weapon:", !!this.rollTarget?.weapon)
|
||||
log("Roll type:", this.type, "rollTarget:", this.rollTarget, "Has weapon:", !!this.rollTarget?.weapon)
|
||||
if (this.type === "weapon-attack" && this.rollTarget?.weapon) {
|
||||
const weapon = this.rollTarget.weapon
|
||||
weaponDamageOptions = {
|
||||
weaponId: weapon._id || weapon.id,
|
||||
weaponId: weapon.id,
|
||||
weaponName: weapon.name,
|
||||
damageM: weapon.system?.damage?.damageM
|
||||
}
|
||||
console.log("Weapon damage options:", weaponDamageOptions)
|
||||
log("Weapon damage options:", weaponDamageOptions)
|
||||
} else if (this.type === "monster-attack" && this.rollTarget) {
|
||||
weaponDamageOptions = {
|
||||
weaponId: this.rollTarget.rollKey,
|
||||
@@ -1481,7 +1481,7 @@ export default class LethalFantasyRoll extends Roll {
|
||||
damageModifier: this.rollTarget.damageModifier,
|
||||
isMonster: true
|
||||
}
|
||||
console.log("Monster damage options:", weaponDamageOptions)
|
||||
log("Monster damage options:", weaponDamageOptions)
|
||||
}
|
||||
|
||||
const cardData = {
|
||||
|
||||
Reference in New Issue
Block a user