forked from External/mage
* Fixed card movement handling for face down cards.
This commit is contained in:
parent
5ee01868a9
commit
f50e67e385
8 changed files with 53 additions and 47 deletions
|
|
@ -152,6 +152,9 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
for (UUID uuid : abilityTargets) {
|
||||
MageObject mageObject = game.getObject(uuid);
|
||||
if (mageObject != null) {
|
||||
if ((mageObject instanceof Card) && ((Card) mageObject).isFaceDown(game)) {
|
||||
continue;
|
||||
}
|
||||
names.add(GameLog.getColoredObjectIdNameForTooltip(mageObject));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,10 +143,10 @@ class NecropotenceEffect extends OneShotEffect {
|
|||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, false)) {
|
||||
card.setFaceDown(true, game);
|
||||
Effect returnToHandeffect = new ReturnToHandTargetEffect(false);
|
||||
returnToHandeffect.setText("put that face down card into your hand");
|
||||
returnToHandeffect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandeffect, TargetController.YOU);
|
||||
Effect returnToHandEffect = new ReturnToHandTargetEffect(false);
|
||||
returnToHandEffect.setText("put that face down card into your hand");
|
||||
returnToHandEffect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandEffect, TargetController.YOU);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class VillainousWealthEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
Cards cardsToExile = new CardsImpl();
|
||||
cardsToExile.addAll(player.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
|
||||
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game, true);
|
||||
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game);
|
||||
if (controller.chooseUse(Outcome.PlayForFree, "Cast cards exiled with " + mageObject.getLogName() + " without paying its mana cost?", source, game)) {
|
||||
OuterLoop:
|
||||
while (cardsToExile.count(filter, game) > 0) {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class LobotomyEffect extends OneShotEffect {
|
|||
|
||||
}
|
||||
if (!cardsToExile.isEmpty()) {
|
||||
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game, true);
|
||||
controller.moveCards(cardsToExile, null, Zone.EXILED, source, game);
|
||||
}
|
||||
targetPlayer.shuffleLibrary(game);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.sets.tempest;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -110,7 +111,11 @@ class ScrollRackEffect extends OneShotEffect {
|
|||
}
|
||||
// Put that many cards from the top of your library into your hand.
|
||||
if (amountExiled > 0) {
|
||||
controller.moveCards(controller.getLibrary().getTopCards(game, amountExiled), null, Zone.HAND, source, game, false);
|
||||
Set<Card> cards = controller.getLibrary().getTopCards(game, amountExiled);
|
||||
for (Card card : cards) {
|
||||
card.setFaceDown(true, game);
|
||||
}
|
||||
controller.moveCards(cards, null, Zone.HAND, source, game);
|
||||
}
|
||||
// Then look at the exiled cards and put them on top of your library in any order
|
||||
controller.putCardsOnTopOfLibrary(game.getExile().getExileZone(source.getSourceId()), game, source, true);
|
||||
|
|
|
|||
|
|
@ -1677,21 +1677,20 @@ public class TestPlayer implements Player {
|
|||
return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
return computerPlayer.moveCards(card, fromZone, toZone, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
// return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
// return computerPlayer.moveCards(card, fromZone, toZone, source, game);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
// return computerPlayer.moveCards(cards, fromZone, toZone, source, game);
|
||||
// }
|
||||
@Override
|
||||
public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game) {
|
||||
return computerPlayer.moveCardToHandWithInfo(card, sourceId, game);
|
||||
|
|
|
|||
|
|
@ -620,16 +620,13 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
*/
|
||||
boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game);
|
||||
|
||||
boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
|
||||
|
||||
// boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
|
||||
boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game);
|
||||
|
||||
boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
|
||||
|
||||
// boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
|
||||
boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game);
|
||||
|
||||
boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
|
||||
|
||||
// boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName);
|
||||
boolean moveCardsToExile(Set<Card> cards, Ability source, Game game, boolean withName, UUID exileId, String exileZoneName);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2873,14 +2873,14 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
public UUID getCommanderId() {
|
||||
return this.commanderId;
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
// return moveCards(cards, fromZone, toZone, source, game, true);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
return moveCards(cards, fromZone, toZone, source, game, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
Set<Card> cardList = new HashSet<>();
|
||||
for (UUID cardId : cards) {
|
||||
if (fromZone == null) {
|
||||
|
|
@ -2898,30 +2898,28 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
}
|
||||
return moveCards(cardList, fromZone, toZone, source, game, withName);
|
||||
return moveCards(cardList, fromZone, toZone, source, game);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
// return moveCards(card, fromZone, toZone, source, game, true);
|
||||
// }
|
||||
@Override
|
||||
public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
return moveCards(card, fromZone, toZone, source, game, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
Set<Card> cardList = new HashSet<>();
|
||||
if (card != null) {
|
||||
cardList.add(card);
|
||||
}
|
||||
return moveCards(cardList, fromZone, toZone, source, game, withName);
|
||||
return moveCards(cardList, fromZone, toZone, source, game);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
// return moveCards(cards, fromZone, toZone, source, game, true);
|
||||
// }
|
||||
@Override
|
||||
public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game) {
|
||||
return moveCards(cards, fromZone, toZone, source, game, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveCards(Set<Card> cards, Zone fromZone, Zone toZone, Ability source, Game game, boolean withName) {
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2931,6 +2929,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
boolean result = false;
|
||||
for (Card card : cards) {
|
||||
fromZone = game.getState().getZone(card.getId());
|
||||
boolean withName = (fromZone.equals(Zone.BATTLEFIELD) || fromZone.equals(Zone.STACK)) || !card.isFaceDown(game);
|
||||
result |= moveCardToExileWithInfo(card, null, "", source == null ? null : source.getSourceId(), game, fromZone, withName);
|
||||
}
|
||||
return result;
|
||||
|
|
@ -2940,20 +2939,23 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
result = false;
|
||||
for (Card card : cards) {
|
||||
fromZone = game.getState().getZone(card.getId());
|
||||
result |= moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, withName);
|
||||
boolean hideCard = fromZone.equals(Zone.LIBRARY)
|
||||
|| (card.isFaceDown(game) && !fromZone.equals(Zone.STACK) && !fromZone.equals(Zone.BATTLEFIELD));
|
||||
result |= moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, !hideCard);
|
||||
}
|
||||
return result;
|
||||
case BATTLEFIELD:
|
||||
result = false;
|
||||
for (Card card : cards) {
|
||||
fromZone = game.getState().getZone(card.getId());
|
||||
result |= putOntoBattlefieldWithInfo(card, game, fromZone, source == null ? null : source.getSourceId(), false, !withName);
|
||||
result |= putOntoBattlefieldWithInfo(card, game, fromZone, source == null ? null : source.getSourceId(), false, !card.isFaceDown(game));
|
||||
}
|
||||
return result;
|
||||
case LIBRARY:
|
||||
result = false;
|
||||
for (Card card : cards) {
|
||||
fromZone = game.getState().getZone(card.getId());
|
||||
boolean withName = fromZone.equals(Zone.BATTLEFIELD) || !card.isFaceDown(game);
|
||||
result |= moveCardToLibraryWithInfo(card, source == null ? null : source.getSourceId(), game, fromZone, true, withName);
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue