Fixed bug with PrimevalTitan and all cards with SearchLibraryPutInPlayEffect.

This commit is contained in:
magenoxx 2012-05-03 05:39:45 +04:00
parent f39d5dbca1
commit 41a5bb7496
2 changed files with 11 additions and 6 deletions

View file

@ -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<SearchLibraryPutI
for (UUID cardId: (List<UUID>)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)

View file

@ -353,20 +353,24 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
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);