* 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); Card card = controller.getLibrary().removeFromTop(game);
if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY)) { if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY)) {
card.setFaceDown(true, game); card.setFaceDown(true, game);
Effect returnToHandeffect = new ReturnToHandTargetEffect(); Effect returnToHandeffect = new ReturnToHandTargetEffect(false);
returnToHandeffect.setText("put that face down card into your hand"); returnToHandeffect.setText("put that face down card into your hand");
returnToHandeffect.setTargetPointer(new FixedTarget(card.getId())); returnToHandeffect.setTargetPointer(new FixedTarget(card.getId()));
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandeffect, TargetController.YOU); DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandeffect, TargetController.YOU);

View file

@ -49,12 +49,20 @@ import mage.util.CardUtil;
*/ */
public class ReturnToHandTargetEffect extends OneShotEffect { public class ReturnToHandTargetEffect extends OneShotEffect {
boolean withName;
public ReturnToHandTargetEffect() { public ReturnToHandTargetEffect() {
this(true);
}
public ReturnToHandTargetEffect(boolean withName) {
super(Outcome.ReturnToHand); super(Outcome.ReturnToHand);
this.withName = withName;
} }
public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) { public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) {
super(effect); super(effect);
this.withName = effect.withName;
} }
@Override @Override
@ -74,7 +82,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
case BATTLEFIELD: case BATTLEFIELD:
Permanent permanent = game.getPermanent(targetId); Permanent permanent = game.getPermanent(targetId);
if (permanent != null) { if (permanent != null) {
controller.moveCardToHandWithInfo((Card) permanent, source.getSourceId(), game, Zone.BATTLEFIELD); controller.moveCardToHandWithInfo((Card) permanent, source.getSourceId(), game, Zone.BATTLEFIELD, withName);
} else { } else {
result = false; result = false;
} }
@ -82,7 +90,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
case GRAVEYARD: case GRAVEYARD:
Card card = game.getCard(targetId); Card card = game.getCard(targetId);
if (card != null) { if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD); controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD, withName);
} else { } else {
result = false; result = false;
} }
@ -90,7 +98,7 @@ public class ReturnToHandTargetEffect extends OneShotEffect {
case EXILED: case EXILED:
card = game.getCard(targetId); card = game.getCard(targetId);
if (card != null) { if (card != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.EXILED); controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.EXILED, withName);
} else { } else {
result = false; result = false;
} }

View file

@ -434,6 +434,16 @@ public interface Player extends MageItem, Copyable<Player> {
* @return * @return
*/ */
boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone); 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 * 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 @Override
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) { 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; boolean result = false;
if (card.moveToZone(Zone.HAND, sourceId, game, false)) { if (card.moveToZone(Zone.HAND, sourceId, game, false)) {
if (card instanceof PermanentCard) { if (card instanceof PermanentCard) {
card = game.getCard(card.getId()); card = game.getCard(card.getId());
} }
game.informPlayers(new StringBuilder(this.getName()) 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(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()); .append(card.getOwnerId().equals(this.getId()) ? "into his or her hand" : "into its owner's hand").toString());
result = true; result = true;