[CLB] Fixes Gond Gate from triggering on itself. Closes #9125.

This commit is contained in:
Alex Vasile 2022-06-25 10:34:33 -04:00
parent efda22c993
commit 8cdfd1ee4a

View file

@ -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);
}