From 41a5bb74967fa292adcf6a62e5eff27eaf25ca74 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Thu, 3 May 2012 05:39:45 +0400 Subject: [PATCH] Fixed bug with PrimevalTitan and all cards with SearchLibraryPutInPlayEffect. --- .../common/search/SearchLibraryPutInPlayEffect.java | 7 ++++--- Mage/src/mage/cards/CardImpl.java | 10 +++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java index 1f6ec5955a..003741cd70 100644 --- a/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java +++ b/Mage/src/mage/abilities/effects/common/search/SearchLibraryPutInPlayEffect.java @@ -28,8 +28,6 @@ package mage.abilities.effects.common.search; -import java.util.List; -import java.util.UUID; import mage.Constants.Outcome; import mage.Constants.Zone; import mage.abilities.Ability; @@ -40,6 +38,9 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInLibrary; +import java.util.List; +import java.util.UUID; + /** * * @author BetaSteward_at_googlemail.com @@ -93,7 +94,7 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect)target.getTargets()) { Card card = player.getLibrary().getCard(cardId, game); if (card != null) { - if (card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId())) { + if (card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId())) { if (tapped) { Permanent permanent = game.getPermanent(card.getId()); if (permanent != null) diff --git a/Mage/src/mage/cards/CardImpl.java b/Mage/src/mage/cards/CardImpl.java index 72c3136357..d941c787f7 100644 --- a/Mage/src/mage/cards/CardImpl.java +++ b/Mage/src/mage/cards/CardImpl.java @@ -353,20 +353,24 @@ public abstract class CardImpl> extends MageObjectImpl ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, controllerId, fromZone, Zone.BATTLEFIELD); if (!game.replaceEvent(event)) { if (fromZone != null) { + boolean removed = false; switch (fromZone) { case GRAVEYARD: - game.getPlayer(ownerId).removeFromGraveyard(this, game); + removed = game.getPlayer(ownerId).removeFromGraveyard(this, game); break; case HAND: - game.getPlayer(ownerId).removeFromHand(this, game); + removed = game.getPlayer(ownerId).removeFromHand(this, game); break; case LIBRARY: - game.getPlayer(ownerId).removeFromLibrary(this, game); + removed = game.getPlayer(ownerId).removeFromLibrary(this, game); break; default: //logger.warning("putOntoBattlefield, not fully implemented: from="+fromZone); } game.rememberLKI(objectId, event.getFromZone(), this); + if (!removed) { + logger.warn("Couldn't find card in fromZone, card=" + getName() + ", fromZone=" + fromZone); + } } PermanentCard permanent = new PermanentCard(this, controllerId); game.getBattlefield().addPermanent(permanent);