From 513085bbcc851bbb2e0803e58b7fcc80dd81f31e Mon Sep 17 00:00:00 2001 From: Alex Vasile <48962821+Alex-Vasile@users.noreply.github.com> Date: Sun, 17 Jul 2022 21:08:09 -0400 Subject: [PATCH] Fixed Banishing Light-type effects to not exile creatures if the source permanent is not on the battlefield when the effect resolves. Closes #8899. --- .../src/mage/cards/l/LagrellaTheMagpie.java | 5 +++++ .../common/ExileUntilSourceLeavesEffect.java | 20 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/l/LagrellaTheMagpie.java b/Mage.Sets/src/mage/cards/l/LagrellaTheMagpie.java index 20de8227915..1a9c3627e7d 100644 --- a/Mage.Sets/src/mage/cards/l/LagrellaTheMagpie.java +++ b/Mage.Sets/src/mage/cards/l/LagrellaTheMagpie.java @@ -87,6 +87,11 @@ class LagrellaTheMagpieEffect extends OneShotEffect { if (player == null) { return false; } + // Like other Banishing Light effects, no permanents get exiled if Lagrella is not in the battlefield when this ability resolves. + if (game.getPermanent(source.getSourceId()) == null) { + return false; + } + Cards cards = new CardsImpl(); this.getTargetPointer() .getTargets(game, source) diff --git a/Mage/src/main/java/mage/abilities/effects/common/ExileUntilSourceLeavesEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ExileUntilSourceLeavesEffect.java index fb0acb195fe..d3c84642fe3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ExileUntilSourceLeavesEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ExileUntilSourceLeavesEffect.java @@ -30,13 +30,19 @@ public class ExileUntilSourceLeavesEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - ExileTargetEffect effect = new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName()); - if (targetPointer != null) { // Grasping Giant - effect.setTargetPointer(targetPointer); - } - return effect.apply(game, source); + if (permanent == null) { + return false; } - return false; + // If Banishing Light leaves the battlefield before its triggered ability resolves, the target permanent won't be exiled. + // (2021-03-19) + if (game.getPermanent(source.getSourceId()) == null) { + return false; + } + + ExileTargetEffect effect = new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName()); + if (targetPointer != null) { // Grasping Giant + effect.setTargetPointer(targetPointer); + } + return effect.apply(game, source); } }