* Necropotence - Fixed that the face down card going to hand was revealed in game log.

This commit is contained in:
LevelX2 2015-03-26 08:25:35 +01:00
parent 1ffb7946dc
commit ab661c44f0
4 changed files with 30 additions and 5 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -434,6 +434,16 @@ public interface Player extends MageItem, Copyable<Player> {
* @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

View file

@ -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;