* Bottled Cloister - Fixed a Null Pointer Exception bug.

This commit is contained in:
LevelX2 2014-07-21 17:20:01 +02:00
parent 859e945799
commit c794dab8d1

View file

@ -40,6 +40,7 @@ import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.ExileZone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -134,15 +135,18 @@ class BottledCloisterReturnEffect extends OneShotEffect {
if (controller != null && sourcePermanent != null) { if (controller != null && sourcePermanent != null) {
UUID exileId = CardUtil.getCardExileZoneId(game, source); UUID exileId = CardUtil.getCardExileZoneId(game, source);
int numberOfCards = 0; int numberOfCards = 0;
for (Card card: game.getExile().getExileZone(exileId).getCards(game)) { ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone != null) {
for (Card card: exileZone.getCards(game)) {
if (card.getOwnerId().equals(controller.getId())) { if (card.getOwnerId().equals(controller.getId())) {
numberOfCards++; numberOfCards++;
card.setFaceDown(false); card.setFaceDown(false);
card.moveToZone(Zone.HAND, source.getSourceId(), game, true); card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
} }
} }
}
if (numberOfCards > 0) { if (numberOfCards > 0) {
game.informPlayers(sourcePermanent.getName() + ": " + controller.getName() + " returns "+ numberOfCards + " card" + (numberOfCards > 1 ?"s":"") + " from exile to hand"); game.informPlayers(sourcePermanent.getLogName() + ": " + controller.getName() + " returns "+ numberOfCards + " card" + (numberOfCards > 1 ?"s":"") + " from exile to hand");
} }
return true; return true;
} }