From 4c1754b9bff3471422b5219df8c2e46cdff0bb06 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 25 Sep 2015 00:34:02 +0200 Subject: [PATCH] * Tempt with Discovery - Fixed that players had not to shuffle their library after card search. --- .../commander2013/TemptWithDiscovery.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Mage.Sets/src/mage/sets/commander2013/TemptWithDiscovery.java b/Mage.Sets/src/mage/sets/commander2013/TemptWithDiscovery.java index e684acd3028..608f28407cd 100644 --- a/Mage.Sets/src/mage/sets/commander2013/TemptWithDiscovery.java +++ b/Mage.Sets/src/mage/sets/commander2013/TemptWithDiscovery.java @@ -27,6 +27,8 @@ */ package mage.sets.commander2013; +import java.util.LinkedHashSet; +import java.util.Set; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; @@ -51,7 +53,6 @@ public class TemptWithDiscovery extends CardImpl { super(ownerId, 174, "Tempt with Discovery", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{G}"); this.expansionSetCode = "C13"; - // Tempting offer - Search your library for a land card and put it onto the battlefield. // Each opponent may search his or her library for a land card and put it onto the battlefield. // For each opponent who searches a library this way, search your library for a land card and put it onto the battlefield. @@ -89,12 +90,14 @@ class TemptWithDiscoveryEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { + Set playersShuffle = new LinkedHashSet<>(); + playersShuffle.add(controller.getId()); TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard()); if (controller.searchLibrary(target, game)) { - for (UUID cardId: target.getTargets()) { + for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); if (card != null) { - card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), controller.getId()); + controller.moveCards(card, null, Zone.BATTLEFIELD, source, game); } } } @@ -105,11 +108,12 @@ class TemptWithDiscoveryEffect extends OneShotEffect { if (opponent.chooseUse(outcome, "Search your library for a land card and put it onto the battlefield?", source, game)) { target.clearChosen(); opponentsUsedSearch++; + playersShuffle.add(playerId); if (opponent.searchLibrary(target, game)) { - for (UUID cardId: target.getTargets()) { + for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); if (card != null) { - card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), opponent.getId()); + opponent.moveCards(card, null, Zone.BATTLEFIELD, source, game); } } } @@ -119,17 +123,23 @@ class TemptWithDiscoveryEffect extends OneShotEffect { if (opponentsUsedSearch > 0) { target = new TargetCardInLibrary(0, opponentsUsedSearch, new FilterLandCard()); if (controller.searchLibrary(target, game)) { - for (UUID cardId: target.getTargets()) { + for (UUID cardId : target.getTargets()) { Card card = game.getCard(cardId); if (card != null) { - card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), controller.getId()); + controller.moveCards(card, null, Zone.BATTLEFIELD, source, game); } } } } + for (UUID playerId : playersShuffle) { + Player player = game.getPlayer(playerId); + if (player != null) { + player.shuffleLibrary(game); + } + } return true; } - + return false; } }