Correction erreur onMsgEncaisser

Pas d'actor passé pour déterminer si on doit gérer le message
This commit is contained in:
Vincent Vandemeulebrouck 2024-11-24 16:27:28 +01:00
parent 864194e3b4
commit a91264cd82

View File

@ -435,11 +435,10 @@ export class RdDCombat {
/* -------------------------------------------- */ /* -------------------------------------------- */
static onMsgEncaisser(msg) { static onMsgEncaisser(msg) {
if (Misc.isOwnerPlayerOrUniqueConnectedGM()) { let defender = canvas.tokens.get(msg.defenderToken.id).actor;
if (Misc.isOwnerPlayerOrUniqueConnectedGM(defender)) {
let attackerRoll = msg.attackerRoll; let attackerRoll = msg.attackerRoll;
let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : undefined; let attacker = msg.attackerId ? game.actors.get(msg.attackerId) : undefined;
let defender = canvas.tokens.get(msg.defenderToken.id).actor;
defender.encaisserDommages(attackerRoll, attacker, msg.attackerToken); defender.encaisserDommages(attackerRoll, attacker, msg.attackerToken);
const rddCombat = RdDCombat.rddCombatForAttackerAndDefender(msg.attackerId, msg.attackerToken.id, msg.defenderToken.id); const rddCombat = RdDCombat.rddCombatForAttackerAndDefender(msg.attackerId, msg.attackerToken.id, msg.defenderToken.id);
rddCombat?.removeChatMessageActionsPasseArme(attackerRoll.passeArme); rddCombat?.removeChatMessageActionsPasseArme(attackerRoll.passeArme);