From 1d10c0bd3f4c5240049db86265f73405a74b3540 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 27 May 2021 00:20:40 +0200 Subject: [PATCH] mineur: plus besoin de joueur pour la defense --- module/rdd-combat.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 6072a668..0fb909b4 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -491,20 +491,14 @@ export class RdDCombat { /* -------------------------------------------- */ static onMsgDefense(msg) { let defenderToken = canvas.tokens.get(msg.defenderTokenId); - if (defenderToken) { - if (!game.user.isGM && !game.user.character) { // vérification / sanity check - ui.notifications.error("Le joueur " + game.user.name + " n'est connecté à aucun personnage. Impossible de continuer."); - return; - } - if (Misc.isElectedUser()) { - const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId); - if (rddCombat) { - const defenderRoll = msg.defenderRoll; - RdDCombat._storeAttaque(msg.attackerId, defenderRoll.attackerRoll); - RdDCombat._storeDefense(defenderRoll); - rddCombat.removeChatMessageActionsPasseArme(defenderRoll.passeArme); - rddCombat._chatMessageDefense(msg.paramChatDefense); - } + if (defenderToken && Misc.isElectedUser()) { + const rddCombat = RdDCombat.createForAttackerAndDefender(msg.attackerId, msg.defenderTokenId); + if (rddCombat) { + const defenderRoll = msg.defenderRoll; + RdDCombat._storeAttaque(msg.attackerId, defenderRoll.attackerRoll); + RdDCombat._storeDefense(defenderRoll); + rddCombat.removeChatMessageActionsPasseArme(defenderRoll.passeArme); + rddCombat._chatMessageDefense(msg.paramChatDefense); } } }