From 8cdfd1ee4ae1763e7c0b73f3064c494b87b6a690 Mon Sep 17 00:00:00 2001 From: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com> Date: Sat, 25 Jun 2022 10:34:33 -0400 Subject: [PATCH] [CLB] Fixes Gond Gate from triggering on itself. Closes #9125. --- Mage.Sets/src/mage/cards/g/GondGate.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GondGate.java b/Mage.Sets/src/mage/cards/g/GondGate.java index 369e63d35d6..8949ba5b79a 100644 --- a/Mage.Sets/src/mage/cards/g/GondGate.java +++ b/Mage.Sets/src/mage/cards/g/GondGate.java @@ -62,7 +62,11 @@ class GondGateEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - ((EntersTheBattlefieldEvent) event).getTarget().setTapped(false); + Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); + if (target != null) { + target.setTapped(false); + } + return false; } @@ -73,8 +77,17 @@ class GondGateEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { + Permanent sourceObject = game.getPermanent(source.getSourceId()); + if (sourceObject == null) { + return false; + } + Permanent targetObject = ((EntersTheBattlefieldEvent) event).getTarget(); - return targetObject != null + if (targetObject == null) { + return false; + } + + return !sourceObject.getId().equals(targetObject.getId()) && targetObject.isControlledBy(source.getControllerId()) && targetObject.hasSubtype(SubType.GATE, game); }