* Fixed a bug that prevented asThoughAs continuous effects correctly change controller (e.g. play lands from library with a controlled Courser of Kruphix did not work).

This commit is contained in:
LevelX2 2015-06-25 00:57:59 +02:00
parent bb694105a2
commit 76f989a7f0
2 changed files with 167 additions and 158 deletions

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common.search;
import java.util.UUID;
@ -93,9 +92,9 @@ public class SearchLibraryPutInHandEffect extends SearchEffect {
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Cards cards = new CardsImpl();
for (UUID cardId: target.getTargets()) {
for (UUID cardId : target.getTargets()) {
Card card = controller.getLibrary().remove(cardId, game);
if (card != null){
if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, revealCards);
if (revealCards) {
cards.add(card);
@ -106,7 +105,7 @@ public class SearchLibraryPutInHandEffect extends SearchEffect {
String name = "Reveal";
Card sourceCard = game.getCard(source.getSourceId());
if (sourceCard != null) {
name = sourceCard.getName();
name = sourceCard.getIdName();
}
controller.revealCards(name, cards, game);
}
@ -126,14 +125,12 @@ public class SearchLibraryPutInHandEffect extends SearchEffect {
if (target.getNumberOfTargets() == 0 && target.getMaxNumberOfTargets() > 0) {
sb.append("up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
sb.append(target.getTargetName()).append(revealCards ? ", reveal them, " : "").append(" and put them into your hand");
}
else {
} else {
sb.append("a ").append(target.getTargetName()).append(revealCards ? ", reveal it, " : "").append(" and put that card into your hand");
}
if (forceShuffle) {
sb.append(". Then shuffle your library");
}
else {
} else {
sb.append(". If you do, shuffle your library");
}
staticText = sb.toString();