[C13] Fixed Jeleva not exiling cards if killed in response to trigger. Closes
@@ -15,6 +15,7 @@ import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
+import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
@@ -81,18 +82,18 @@ class JelevaNephaliasScourgeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
- MageObject sourceObject = source.getSourceObject(game);
+ Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
JelevaNephaliasWatcher watcher = game.getState().getWatcher(JelevaNephaliasWatcher.class);
if (controller != null
- && sourceObject != null
+ && permanent != null
&& watcher != null) {
- int xValue = watcher.getManaSpentToCastLastTime(sourceObject.getId(), sourceObject.getZoneChangeCounter(game) - 1);
+ int xValue = watcher.getManaSpentToCastLastTime(permanent.getId(), permanent.getZoneChangeCounter(game) - 1);
if (xValue > 0) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.moveCardsToExile(player.getLibrary().getTopCards(game, xValue),
- source, game, true, CardUtil.getCardExileZoneId(game, source), sourceObject.getIdName());
+ source, game, true, CardUtil.getCardExileZoneId(game, source), permanent.getIdName());
}
}
}
