Jet de vie par les propriétaires
Les messages de tour sont séparés en deux: - un message pour tout le monde disant de qui c'est le tour - un message pour les propriétaires du token pour les informations de santé (jets de vie à faire, ...) Seul les propriétaires peuvent déclencher les jets de vie
This commit is contained in:
parent
9d51631d5c
commit
fad29f9652
@ -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,9 +512,13 @@ export class RdDCombat {
|
||||
/* -------------------------------------------- */
|
||||
static _callJetDeVie(event) {
|
||||
let actorId = event.currentTarget.attributes['data-actorId'].value;
|
||||
let actor = game.actors.get(actorId);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static registerChatCallbacks(html) {
|
||||
@ -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
|
||||
});
|
||||
}
|
||||
}
|
@ -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',
|
||||
|
1
templates/chat-actor-turn-acteur.hbs
Normal file
1
templates/chat-actor-turn-acteur.hbs
Normal file
@ -0,0 +1 @@
|
||||
<h4>C'est au tour de {{alias}} !</h4>
|
@ -1,4 +1,4 @@
|
||||
<h4>C'est au tour de {{alias}} !</h4>
|
||||
<h4>Résumé de santé pour {{alias}}</h4>
|
||||
<div data-combatid="{{combatId}}" data-combatmessage="actor-turn-summary">{{blessuresStatus}}</div>
|
||||
<div>Son état général est de : {{etatGeneral}} {{#if isSonne}} et est <strong>sonné</strong>{{/if}}</div>
|
||||
{{#if isGrave}}
|
||||
@ -6,5 +6,7 @@
|
||||
{{/if}}
|
||||
{{#if isCritique}}
|
||||
<div>{{alias}} souffre d'une <strong>Blessure Critique</strong> : faites un
|
||||
<a id="chat-jet-vie" class="chat-card-button" data-actorId="{{actorId}}">Jet de Vie.<a></div>
|
||||
<a class="chat-card-button chat-jet-vie"
|
||||
data-tokenId="{{tokenId}}"
|
||||
data-actorId="{{actorId}}">Jet de Vie.<a></div>
|
||||
{{/if}}
|
Loading…
Reference in New Issue
Block a user