From 4622973639c92f828900466d66f5d0a16642b414 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 22 Nov 2014 11:24:44 +0100 Subject: [PATCH] * Darksteel Colossus - Fixed that the put into graveyard effect did not work correctly for Tokens of Darksteel Colossus. --- .../magic2015/JaliraMasterPolymorphist.java | 2 +- ...vealAndShuffleIntoLibrarySourceEffect.java | 42 ++++++++++++++----- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/Mage.Sets/src/mage/sets/magic2015/JaliraMasterPolymorphist.java b/Mage.Sets/src/mage/sets/magic2015/JaliraMasterPolymorphist.java index 5e944a6835..38d13e8048 100644 --- a/Mage.Sets/src/mage/sets/magic2015/JaliraMasterPolymorphist.java +++ b/Mage.Sets/src/mage/sets/magic2015/JaliraMasterPolymorphist.java @@ -144,7 +144,7 @@ class JaliraMasterPolymorphistEffect extends OneShotEffect { card = cards.getRandom(game); if (card != null) { cards.remove(card); - card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false); + controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.HAND, false, false); } } return true; diff --git a/Mage/src/mage/abilities/effects/common/RevealAndShuffleIntoLibrarySourceEffect.java b/Mage/src/mage/abilities/effects/common/RevealAndShuffleIntoLibrarySourceEffect.java index 4fda331bcd..6e08d58cc9 100644 --- a/Mage/src/mage/abilities/effects/common/RevealAndShuffleIntoLibrarySourceEffect.java +++ b/Mage/src/mage/abilities/effects/common/RevealAndShuffleIntoLibrarySourceEffect.java @@ -37,6 +37,8 @@ import mage.cards.CardsImpl; import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentCard; import mage.players.Player; /** @@ -57,19 +59,37 @@ public class RevealAndShuffleIntoLibrarySourceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Card sourceCard = game.getCard(source.getSourceId()); MageObject sourceObject = game.getObject(source.getSourceId()); - if (sourceCard != null) { - Player player = game.getPlayer(sourceCard.getOwnerId()); - if (player != null) { - Zone fromZone = game.getState().getZone(sourceCard.getId()); - Cards cards = new CardsImpl(); - cards.add(sourceCard); - player.revealCards(sourceObject.getLogName(), cards, game); - player.moveCardToLibraryWithInfo(sourceCard, source.getSourceId(), game, fromZone, true, true); - player.shuffleLibrary(game); - return true; + Player controller = game.getPlayer(source.getControllerId()); + if (sourceObject != null && controller != null) { + Player owner = null; + Cards cards = new CardsImpl(); + Permanent permanent = null; + if (sourceObject instanceof Permanent) { + permanent = (Permanent) sourceObject; + owner = game.getPlayer(permanent.getOwnerId()); + if (sourceObject instanceof PermanentCard) { + cards.add(permanent); + } + } else if (sourceObject instanceof Card) { + owner = game.getPlayer(((Card)sourceObject).getOwnerId()); + cards.add((Card)sourceObject); } + if (owner != null) { + Zone fromZone = game.getState().getZone(sourceObject.getId()); + if (!cards.isEmpty()) { + controller.revealCards(sourceObject.getLogName(), cards, game); + } + if (permanent != null) { + controller.moveCardToLibraryWithInfo(permanent, source.getSourceId(), game, fromZone, true, true); + } else { + controller.moveCardToLibraryWithInfo((Card)sourceObject, source.getSourceId(), game, fromZone, true, true); + } + if (!cards.isEmpty()) { + controller.shuffleLibrary(game); + } + } + return true; } return false; }