From ab661c44f04a3cf7b80b78d762f525b1ea5c9368 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 26 Mar 2015 08:25:35 +0100 Subject: [PATCH] * Necropotence - Fixed that the face down card going to hand was revealed in game log. --- Mage.Sets/src/mage/sets/iceage/Necropotence.java | 2 +- .../effects/common/ReturnToHandTargetEffect.java | 14 +++++++++++--- Mage/src/mage/players/Player.java | 10 ++++++++++ Mage/src/mage/players/PlayerImpl.java | 9 ++++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Mage.Sets/src/mage/sets/iceage/Necropotence.java b/Mage.Sets/src/mage/sets/iceage/Necropotence.java index fea8b3cfd2..febd9fb860 100644 --- a/Mage.Sets/src/mage/sets/iceage/Necropotence.java +++ b/Mage.Sets/src/mage/sets/iceage/Necropotence.java @@ -138,7 +138,7 @@ class NecropotenceEffect extends OneShotEffect { Card card = controller.getLibrary().removeFromTop(game); if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY)) { card.setFaceDown(true, game); - Effect returnToHandeffect = new ReturnToHandTargetEffect(); + Effect returnToHandeffect = new ReturnToHandTargetEffect(false); returnToHandeffect.setText("put that face down card into your hand"); returnToHandeffect.setTargetPointer(new FixedTarget(card.getId())); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandeffect, TargetController.YOU); diff --git a/Mage/src/mage/abilities/effects/common/ReturnToHandTargetEffect.java b/Mage/src/mage/abilities/effects/common/ReturnToHandTargetEffect.java index 4a9114b0d7..b2694de670 100644 --- a/Mage/src/mage/abilities/effects/common/ReturnToHandTargetEffect.java +++ b/Mage/src/mage/abilities/effects/common/ReturnToHandTargetEffect.java @@ -49,12 +49,20 @@ import mage.util.CardUtil; */ public class ReturnToHandTargetEffect extends OneShotEffect { + boolean withName; + public ReturnToHandTargetEffect() { + this(true); + } + + public ReturnToHandTargetEffect(boolean withName) { super(Outcome.ReturnToHand); + this.withName = withName; } public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) { super(effect); + this.withName = effect.withName; } @Override @@ -74,7 +82,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect { case BATTLEFIELD: Permanent permanent = game.getPermanent(targetId); if (permanent != null) { - controller.moveCardToHandWithInfo((Card) permanent, source.getSourceId(), game, Zone.BATTLEFIELD); + controller.moveCardToHandWithInfo((Card) permanent, source.getSourceId(), game, Zone.BATTLEFIELD, withName); } else { result = false; } @@ -82,7 +90,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect { case GRAVEYARD: Card card = game.getCard(targetId); if (card != null) { - controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD); + controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, withName); } else { result = false; } @@ -90,7 +98,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect { case EXILED: card = game.getCard(targetId); if (card != null) { - controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.EXILED); + controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.EXILED, withName); } else { result = false; } diff --git a/Mage/src/mage/players/Player.java b/Mage/src/mage/players/Player.java index abb5471e89..c66868a106 100644 --- a/Mage/src/mage/players/Player.java +++ b/Mage/src/mage/players/Player.java @@ -434,6 +434,16 @@ public interface Player extends MageItem, Copyable { * @return */ boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone); + + /** + * @param card + * @param sourceId + * @param game + * @param withName show the card name in the log + * @param fromZone + * @return + * */ + boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean withName); /** * Uses card.moveToExile and posts a inform message about moving the card to exile diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 327e8c9012..d40e64a365 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -2762,13 +2762,20 @@ public abstract class PlayerImpl implements Player, Serializable { @Override public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { + return this.moveCardToHandWithInfo(card, sourceId, game, fromZone, true); + } + + @Override + public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean withName) { boolean result = false; if (card.moveToZone(Zone.HAND, sourceId, game, false)) { if (card instanceof PermanentCard) { card = game.getCard(card.getId()); } game.informPlayers(new StringBuilder(this.getName()) - .append(" puts ").append(card.getLogName()).append(" ") + .append(" puts ") + .append(withName ? card.getLogName() : "a face down card") + .append(" ") .append(fromZone != null ? new StringBuilder("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" ") : "") .append(card.getOwnerId().equals(this.getId()) ? "into his or her hand" : "into its owner's hand").toString()); result = true;