From 1dc5ee13a3d3ee1c1909953ea895c63b2385fb56 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Tue, 9 May 2023 15:52:07 +0400 Subject: [PATCH] Combat Calligrapher - fixed game error (NPE error) --- Mage.Sets/src/mage/cards/c/CombatCalligrapher.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Mage.Sets/src/mage/cards/c/CombatCalligrapher.java b/Mage.Sets/src/mage/cards/c/CombatCalligrapher.java index 9c2517ebc06..03fbd0f80ac 100644 --- a/Mage.Sets/src/mage/cards/c/CombatCalligrapher.java +++ b/Mage.Sets/src/mage/cards/c/CombatCalligrapher.java @@ -82,12 +82,17 @@ class CombatCalligrapherTriggeredAbility extends TriggeredAbilityImpl { public boolean checkTrigger(GameEvent event, Game game) { Player attacker = game.getPlayer(event.getPlayerId()); Player defender = game.getPlayer(event.getTargetId()); + if (attacker == null || defender == null) { + return false; + } + // Do not trigger if opponent is out of range (not visible as opponent to controller, and not the controller) // or if the person being attacked is not an opponent of the controller. if ((!game.getOpponents(getControllerId()).contains(attacker.getId()) && attacker.getId() != getControllerId()) || !game.getOpponents(getControllerId()).contains(defender.getId())) { return false; } + getEffects().setValue("playerToAttack", defender.getId()); getEffects().setTargetPointer(new FixedTarget(attacker.getId())); return true;