feat: messages Sous tension/Opposé stylisés (template chat-tension.hbs)

Affiche les scores du joueur et du MJ/opposant côte à côte
avec un séparateur VS, résultat coloré, badges et icônes.
This commit is contained in:
2026-07-11 00:19:37 +02:00
parent 272149d300
commit d198daba03
7 changed files with 192 additions and 14 deletions
+12 -13
View File
@@ -325,13 +325,12 @@ $(document).on("click", "[data-action='sousTension']", async function () {
deckManager.addToDiscard(card)
await deckManager.saveDeckState()
const success = totalJoueur >= valeurMJ
ChatMessage.create({
content: `<div class="fvtt-hamalron"><h3>${game.i18n.localize("HAMALRON.Label.sousTension")}</h3>
<p><strong>${actorName}</strong>: ${totalJoueur} vs <strong>MJ</strong>: ${card.name} (${valeurMJ})</p>
<p>${success ? game.i18n.localize("HAMALRON.Label.success") : game.i18n.localize("HAMALRON.Label.failure")}</p></div>`,
style: CONST.CHAT_MESSAGE_STYLES.OTHER,
})
const content = await foundry.applications.handlebars.renderTemplate(
"systems/fvtt-hamalron/templates/chat-tension.hbs",
{ cssClass: "fvtt-hamalron tension-roll", icon: "fa-bolt", label: game.i18n.localize("HAMALRON.Label.sousTension"),
joueurName: actorName, joueurScore: totalJoueur, mjCard: `${card.name} (${valeurMJ})`, mjScore: valeurMJ,
isSuccess: success, isMJ: totalJoueur < valeurMJ, isSousTension: true })
ChatMessage.create({ content, style: CONST.CHAT_MESSAGE_STYLES.OTHER })
})
$(document).on("click", "[data-action='oppose']", async function () {
@@ -356,12 +355,12 @@ $(document).on("click", "[data-action='oppose']", async function () {
await deckManager.saveDeckState()
const success = totalJoueur >= valeurOpposant
ChatMessage.create({
content: `<div class="fvtt-hamalron"><h3>${game.i18n.localize("HAMALRON.Label.oppose")}</h3>
<p><strong>${actorName}</strong>: ${totalJoueur} vs <strong>Opposant</strong>: ${card.name} (${valeurOpposant})</p>
<p>${success ? game.i18n.localize("HAMALRON.Label.success") : game.i18n.localize("HAMALRON.Label.failure")}</p></div>`,
style: CONST.CHAT_MESSAGE_STYLES.OTHER,
})
const content = await foundry.applications.handlebars.renderTemplate(
"systems/fvtt-hamalron/templates/chat-tension.hbs",
{ cssClass: "fvtt-hamalron tension-roll", icon: "fa-shield-halved", label: game.i18n.localize("HAMALRON.Label.oppose"),
joueurName: actorName, joueurScore: totalJoueur, mjCard: `${card.name} (${valeurOpposant})`, mjScore: valeurOpposant,
isSuccess: success, isMJ: totalJoueur < valeurOpposant, isSousTension: false })
ChatMessage.create({ content, style: CONST.CHAT_MESSAGE_STYLES.OTHER })
})
Hooks.on("hotbarDrop", (bar, data, slot) => {