diff --git a/module/rdd-combat.js b/module/rdd-combat.js index ee434acd..c0eea94c 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -75,7 +75,7 @@ export class RdDCombatManager extends Combat { } } } - + /************************************************************************************/ async rollInitiative(ids, formula = undefined, messageOptions = {}) { console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions); @@ -448,7 +448,7 @@ export class RdDCombat { if (Misc.isUniqueConnectedGM()) { let turn = combat.turns.find(t => t.token?.id == combat.current.tokenId); if (turn?.actor) { - RdDCombat.displayActorCombatStatus(combat, turn.actor); + RdDCombat.displayActorCombatStatus(combat, turn.actor, turn.token.id); // TODO Playaudio for player?? } } @@ -512,8 +512,12 @@ export class RdDCombat { /* -------------------------------------------- */ static _callJetDeVie(event) { let actorId = event.currentTarget.attributes['data-actorId'].value; - let actor = game.actors.get(actorId); - actor.jetVie(); + let tokenId = event.currentTarget.attributes['data-tokenId'].value; + let token = canvas.tokens.placeables.find(t => t.id == tokenId) + const actor = token?.actor ?? game.actors.get(actorId); + if (actor?.isOwner) { + actor.jetVie(); + } } /* -------------------------------------------- */ @@ -539,7 +543,7 @@ export class RdDCombat { } }); } - html.on("click", '#chat-jet-vie', event => { + html.on("click", 'a.chat-jet-vie', event => { event.preventDefault(); RdDCombat._callJetDeVie(event); }); @@ -1292,7 +1296,7 @@ export class RdDCombat { } /* -------------------------------------------- */ - static async displayActorCombatStatus(combat, actor) { + static async displayActorCombatStatus(combat, actor, tokenId) { let formData = { combatId: combat._id, alias: actor.name, @@ -1301,12 +1305,18 @@ export class RdDCombat { blessuresStatus: actor.computeResumeBlessure(), SConst: actor.getSConst(), actorId: actor.id, + tokenId: tokenId, isGrave: actor.countBlessures(it => it.isGrave()) > 0, isCritique: actor.countBlessures(it => it.isCritique()) > 0 } - - ChatUtility.createChatWithRollMode(actor.name, { - content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, formData) + await ChatMessage.create({ + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-acteur.hbs`, formData), + alias: actor.name + }); + await ChatMessage.create({ + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-sante.hbs`, formData), + whisper: ChatUtility.getWhisperRecipientsAndGMs(actor.name), + alias: actor.name }); } -} +} \ No newline at end of file diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 703e3c87..b3b188a9 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -245,7 +245,8 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/chat-description.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-info-distance.html', - 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html', + 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-acteur.hbs', + 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-sante.hbs', 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html', 'systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html', diff --git a/templates/chat-actor-turn-acteur.hbs b/templates/chat-actor-turn-acteur.hbs new file mode 100644 index 00000000..ad174c7f --- /dev/null +++ b/templates/chat-actor-turn-acteur.hbs @@ -0,0 +1 @@ +