Fix suppression messages combat

This commit is contained in:
Vincent Vandemeulebrouck 2022-06-06 22:36:04 +02:00
parent 218c88a924
commit 2885ca1c8f

View File

@ -465,15 +465,15 @@ export class RdDCombat {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static onMsgEncaisser(data) { static onMsgEncaisser(msg) {
let defender = canvas.tokens.get(data.defenderTokenId).actor; let defender = canvas.tokens.get(msg.defenderTokenId).actor;
if (Misc.isOwnerPlayerOrUniqueConnectedGM()) { if (Misc.isOwnerPlayerOrUniqueConnectedGM()) {
let attackerRoll = data.attackerRoll; let attackerRoll = msg.attackerRoll;
let attacker = data.attackerId ? game.actors.get(data.attackerId) : null; let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : null;
defender.encaisserDommages(attackerRoll, attacker); defender.encaisserDommages(attackerRoll, attacker);
RdDCombat._deleteDefense(attackerRoll.passeArme); const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);
RdDCombat._deleteAttaque(data.attackerId); rddCombat?.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
} }
} }
@ -482,11 +482,8 @@ export class RdDCombat {
let defenderToken = canvas.tokens.get(msg.defenderTokenId); let defenderToken = canvas.tokens.get(msg.defenderTokenId);
if (defenderToken && Misc.isUniqueConnectedGM()) { if (defenderToken && Misc.isUniqueConnectedGM()) {
const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId); const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId);
if (rddCombat) { rddCombat?.removeChatMessageActionsPasseArme(msg.defenderRoll.passeArme);
const defenderRoll = msg.defenderRoll; rddCombat?._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll);
rddCombat.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
rddCombat._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll);
}
} }
} }
@ -1005,8 +1002,7 @@ export class RdDCombat {
await this.computeRecul(defenderRoll); await this.computeRecul(defenderRoll);
await this.computeDeteriorationArme(defenderRoll); await this.computeDeteriorationArme(defenderRoll);
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html'); await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
RdDCombat._deleteDefense(defenderRoll.passeArme);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1077,7 +1073,7 @@ export class RdDCombat {
async _onEsquiveNormale(defenderRoll) { async _onEsquiveNormale(defenderRoll) {
console.log("RdDCombat._onEsquiveNormal >>>", defenderRoll); console.log("RdDCombat._onEsquiveNormal >>>", defenderRoll);
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.html'); await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-esquive.html');
RdDCombat._deleteDefense(defenderRoll.passeArme); this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -1217,7 +1213,6 @@ export class RdDCombat {
} }
}); });
} }
RdDCombat._deleteDefense(attackerRoll.passeArme);
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme); this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
} }