BOL : Fix damage error, rework roll dialog and new damage targetting

This commit is contained in:
2026-03-16 20:16:58 +01:00
parent 7adc1b3f07
commit a549262d25
121 changed files with 538 additions and 408 deletions

View File

@@ -359,7 +359,7 @@ export class BoLActor extends Actor {
ChatMessage.create({
alias: this.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-activate-fight-option.hbs', { name: this.name, img: fightOption.img, foName: fightOption.name, state: state })
content: await foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-activate-fight-option.hbs', { name: this.name, img: fightOption.img, foName: fightOption.name, state: state })
})
}
@@ -877,7 +877,7 @@ export class BoLActor extends Actor {
ChatMessage.create({
alias: this.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-vitality-zero.hbs', { name: this.name, img: this.img, hp: this.system.resources.hp.value, isHeroAdversary: this.isHeroAdversary() })
content: await foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-vitality-zero.hbs', { name: this.name, img: this.img, hp: this.system.resources.hp.value, isHeroAdversary: this.isHeroAdversary() })
})
} else {
if (prone) {
@@ -912,7 +912,7 @@ export class BoLActor extends Actor {
let msg = await ChatMessage.create({
alias: this.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name),
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-recup-information.hbs', {
content: await foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/chat-recup-information.hbs', {
name: this.name,
img: this.img,
actorId: this.id,

View File

@@ -747,6 +747,12 @@ export class BoLDefaultRoll {
/* -------------------------------------------- */
async sendDamageMessage() {
let actor = BoLUtility.getActorFromRollData(this.rollData)
// If no target, collect potential targets from active scene (excluding attacker)
if (!this.rollData.targetId && game.scenes.current) {
this.rollData.potentialTargets = game.scenes.current.tokens
.filter(t => t.actor && t.actor.id !== this.rollData.actorId)
.map(t => ({ id: t.id, actorId: t.actor.id, name: t.name, img: t.texture?.src || t.actor.img }))
}
this._buildDamageChatMessage(this.rollData).then(async msgFlavor => {
let msg = await this.rollData.damageRoll.toMessage({
user: game.user.id,

View File

@@ -395,6 +395,16 @@ export class BoLUtility {
BoLUtility.sendAttackSuccess(rollData)
});
html.on("click", '.chat-target-select', event => {
event.preventDefault()
const btn = event.currentTarget
let rollData = BoLUtility.getRollDataFromMessage(event)
rollData.targetId = btn.dataset.tokenId
rollData.defenderId = btn.dataset.actorId
BoLUtility.cleanupButtons(rollData.applyId)
BoLUtility.sendAttackSuccess(rollData)
});
html.on("click", '.chat-damage-roll', event => {
event.preventDefault()
let rollData = BoLUtility.getRollDataFromMessage(event)
@@ -554,13 +564,13 @@ export class BoLUtility {
ChatMessage.create({
alias: defender.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(defender.name),
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-result-card.hbs', damageResults)
content: await foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-result-card.hbs', damageResults)
})
console.log("Defender data : ", defenderUser)
ChatMessage.create({
alias: defender.name,
whisper: BoLUtility.getOtherWhisperRecipients(defenderUser?.name),
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-summary-card.hbs', damageResults)
content: await foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-summary-card.hbs', damageResults)
})
}
}
@@ -647,7 +657,7 @@ export class BoLUtility {
let msg = await ChatMessage.create({
alias: defender.name,
whisper: BoLUtility.getWhisperRecipientsAndGMs(defender.name),
content: await foundry.applications.handlebars.foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-request-card.hbs', {
content: await foundry.applications.handlebars.renderTemplate('systems/bol/templates/chat/rolls/defense-request-card.hbs', {
attackId: rollData.id,
attacker: rollData.attacker,
defender: defender,