From 737b8a4cdcab8c12ffbeb41ef6836f1e80d4c6d7 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 17 Sep 2014 23:59:03 +0200 Subject: [PATCH] * Narset, Enlightened Master - Fixed a bug that if more than one card was cast from the exiled cards an java exception appeared. --- .../khansoftarkir/NarsetEnlightenedMaster.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/NarsetEnlightenedMaster.java b/Mage.Sets/src/mage/sets/khansoftarkir/NarsetEnlightenedMaster.java index a37a7a27810..018b844605e 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/NarsetEnlightenedMaster.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/NarsetEnlightenedMaster.java @@ -102,12 +102,12 @@ class NarsetEnlightenedMasterExileEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - if (player != null) { + MageObject sourceObject = game.getObject(source.getSourceId()); + if (player != null && sourceObject != null) { for (int i = 0; i < 4; i++) { if (player.getLibrary().size() > 0) { - Card card = player.getLibrary().removeFromTop(game); - MageObject sourceObject = game.getObject(source.getSourceId()); - if (card != null && sourceObject != null) { + Card card = player.getLibrary().getFromTop(game); + if (card != null) { player.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), sourceObject.getLogName(), source.getSourceId(), game, Zone.LIBRARY); if (!card.getCardType().contains(CardType.CREATURE)) { ContinuousEffect effect = new NarsetEnlightenedMasterCastFromExileEffect(); @@ -150,12 +150,12 @@ class NarsetEnlightenedMasterCastFromExileEffect extends AsThoughEffectImpl { } @Override - public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { - if (getTargetPointer().getFirst(game, source).equals(sourceId) && affectedControllerId.equals(source.getControllerId())) { - Card card = game.getCard(sourceId); - if (card != null && game.getState().getZone(sourceId) == Zone.EXILED) { + public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { + if (objectId.equals(getTargetPointer().getFirst(game, source)) && affectedControllerId.equals(source.getControllerId())) { + Card card = game.getCard(objectId); + if (card != null && game.getState().getZone(objectId) == Zone.EXILED) { Player player = game.getPlayer(affectedControllerId); - player.setCastSourceIdWithoutMana(sourceId); + player.setCastSourceIdWithoutMana(objectId); return true; } }