mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
Fixed some problems that searching for split cards did not always work (e.g. Surgical Extraction).
This commit is contained in:
parent
ad645b0af5
commit
8b82e240c8
12 changed files with 172 additions and 123 deletions
|
|
@ -27,6 +27,8 @@
|
|||
*/
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -34,6 +36,7 @@ import mage.abilities.keyword.SplitSecondAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
|
|
@ -49,9 +52,6 @@ import mage.target.common.TargetCardInGraveyard;
|
|||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jonubuu
|
||||
|
|
@ -65,7 +65,7 @@ public class Extirpate extends CardImpl {
|
|||
}
|
||||
|
||||
public Extirpate(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
|
||||
|
||||
// Split second
|
||||
this.addAbility(new SplitSecondAbility());
|
||||
|
|
@ -114,7 +114,8 @@ class ExtirpateEffect extends OneShotEffect {
|
|||
// Exile all cards with the same name
|
||||
// Building a card filter with the name
|
||||
FilterCard filterNamedCard = new FilterCard();
|
||||
filterNamedCard.add(new NamePredicate(chosenCard.getName()));
|
||||
String nameToSearch = chosenCard.isSplitCard() ? ((SplitCard) chosenCard).getLeftHalfCard().getName() : chosenCard.getName();
|
||||
filterNamedCard.add(new NamePredicate(nameToSearch));
|
||||
|
||||
// The cards you're searching for must be found and exiled if they're in the graveyard because it's a public zone.
|
||||
// Finding those cards in the hand and library is optional, because those zones are hidden (even if the hand is temporarily revealed).
|
||||
|
|
|
|||
|
|
@ -25,27 +25,26 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.cards.h;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterBasicLandCard;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -53,7 +52,7 @@ import mage.filter.predicate.mageobject.NamePredicate;
|
|||
public class HauntingEchoes extends CardImpl {
|
||||
|
||||
public HauntingEchoes(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}{B}");
|
||||
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
this.getSpellAbility().addEffect(new HauntingEchoesEffect());
|
||||
|
|
@ -87,18 +86,19 @@ class HauntingEchoesEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (targetPlayer != null) {
|
||||
for (Card card: targetPlayer.getGraveyard().getCards(game)) {
|
||||
for (Card card : targetPlayer.getGraveyard().getCards(game)) {
|
||||
if (!filter.match(card, game)) {
|
||||
card.moveToExile(null, "", source.getSourceId(), game);
|
||||
|
||||
FilterCard filterCard = new FilterCard("cards named " + card.getName());
|
||||
filterCard.add(new NamePredicate(card.getName()));
|
||||
String nameToSearch = card.isSplitCard() ? ((SplitCard) card).getLeftHalfCard().getName() : card.getName();
|
||||
filterCard.add(new NamePredicate(nameToSearch));
|
||||
int count = targetPlayer.getLibrary().count(filterCard, game);
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(count, count, filterCard);
|
||||
|
||||
player.searchLibrary(target, game, targetPlayer.getId());
|
||||
List<UUID> targets = target.getTargets();
|
||||
for(UUID cardId : targets){
|
||||
for (UUID cardId : targets) {
|
||||
Card libraryCard = game.getCard(cardId);
|
||||
if (libraryCard != null) {
|
||||
libraryCard.moveToExile(null, "", source.getSourceId(), game);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
|
|
@ -56,8 +57,7 @@ import mage.target.common.TargetCardInLibrary;
|
|||
public class InfernalTutor extends CardImpl {
|
||||
|
||||
public InfernalTutor(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
|
||||
|
||||
// Reveal a card from your hand. Search your library for a card with the same name as that card, reveal it, put it into your hand, then shuffle your library.
|
||||
this.getSpellAbility().addEffect(new InfernalTutorEffect());
|
||||
|
|
@ -115,8 +115,9 @@ class InfernalTutorEffect extends OneShotEffect {
|
|||
FilterCard filterCard;
|
||||
if (cardToReveal != null) {
|
||||
controller.revealCards("from hand :" + sourceObject.getName(), new CardsImpl(cardToReveal), game);
|
||||
filterCard = new FilterCard("card named " + cardToReveal.getName());
|
||||
filterCard.add(new NamePredicate(cardToReveal.getName()));
|
||||
String nameToSearch = cardToReveal.isSplitCard() ? ((SplitCard) cardToReveal).getLeftHalfCard().getName() : cardToReveal.getName();
|
||||
filterCard = new FilterCard("card named " + nameToSearch);
|
||||
filterCard.add(new NamePredicate(nameToSearch));
|
||||
} else {
|
||||
filterCard = new FilterCard();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
|
@ -46,8 +47,6 @@ import mage.target.TargetCard;
|
|||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
|
@ -55,7 +54,7 @@ import java.util.UUID;
|
|||
public class Lobotomy extends CardImpl {
|
||||
|
||||
public Lobotomy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{U}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{B}");
|
||||
|
||||
// Target player reveals his or her hand, then you choose a card other than a basic land card from it. Search that player's graveyard, hand, and library for all cards with the same name as the chosen card and exile them. Then that player shuffles his or her library.
|
||||
this.getSpellAbility().addEffect(new LobotomyEffect());
|
||||
|
|
@ -110,12 +109,12 @@ class LobotomyEffect extends OneShotEffect {
|
|||
// Exile all cards with the same name
|
||||
// Building a card filter with the name
|
||||
FilterCard filterNamedCards = new FilterCard();
|
||||
String nameToSearch = "---";// so no card matches
|
||||
if (chosenCard != null) {
|
||||
filterNamedCards.add(new NamePredicate(chosenCard.getName()));
|
||||
nameToSearch = chosenCard.isSplitCard() ? ((SplitCard) chosenCard).getLeftHalfCard().getName() : chosenCard.getName();
|
||||
filterNamedCards.setMessage("cards named " + chosenCard.getName());
|
||||
} else {
|
||||
filterNamedCards.add(new NamePredicate("----")); // so no card matches
|
||||
}
|
||||
filterNamedCards.add(new NamePredicate(nameToSearch));
|
||||
Cards cardsToExile = new CardsImpl();
|
||||
// The cards you're searching for must be found and exiled if they're in the graveyard because it's a public zone.
|
||||
// Finding those cards in the hand and library is optional, because those zones are hidden (even if the hand is temporarily revealed).
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -58,8 +59,7 @@ import mage.target.common.TargetOpponent;
|
|||
public class ReapIntellect extends CardImpl {
|
||||
|
||||
public ReapIntellect(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{2}{U}{B}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{2}{U}{B}");
|
||||
|
||||
// Target opponent reveals his or her hand. You choose up to X nonland cards from it and exile them. For each card exiled this way, search that player's graveyard, hand, and library for any number of cards with the same name as that card and exile them. Then that player shuffles his or her library.
|
||||
this.getSpellAbility().addEffect(new ReapIntellectEffect());
|
||||
|
|
@ -124,11 +124,11 @@ class ReapIntellectEffect extends OneShotEffect {
|
|||
// Building a card filter with all names
|
||||
ArrayList<NamePredicate> names = new ArrayList<>();
|
||||
FilterCard filterNamedCards = new FilterCard();
|
||||
for (Card card: exiledCards.getCards(game)) {
|
||||
for (Card card : exiledCards.getCards(game)) {
|
||||
if (exiledCards.size() == 1) {
|
||||
filterNamedCards.add(new NamePredicate(card.getName()));
|
||||
filterNamedCards.add(new NamePredicate(card.isSplitCard() ? ((SplitCard) card).getLeftHalfCard().getName() : card.getName()));
|
||||
} else {
|
||||
names.add(new NamePredicate(card.getName()));
|
||||
names.add(new NamePredicate(card.isSplitCard() ? ((SplitCard) card).getLeftHalfCard().getName() : card.getName()));
|
||||
}
|
||||
}
|
||||
if (exiledCards.size() > 1) {
|
||||
|
|
@ -138,7 +138,7 @@ class ReapIntellectEffect extends OneShotEffect {
|
|||
// search cards in graveyard
|
||||
TargetCardInGraveyard targetCardsGraveyard = new TargetCardInGraveyard(0, Integer.MAX_VALUE, filterNamedCards);
|
||||
controller.chooseTarget(outcome, targetPlayer.getGraveyard(), targetCardsGraveyard, source, game);
|
||||
for(UUID cardId: targetCardsGraveyard.getTargets()) {
|
||||
for (UUID cardId : targetCardsGraveyard.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
|
||||
|
|
@ -148,7 +148,7 @@ class ReapIntellectEffect extends OneShotEffect {
|
|||
// search cards in hand
|
||||
TargetCardInHand targetCardsHand = new TargetCardInHand(0, Integer.MAX_VALUE, filterNamedCards);
|
||||
controller.chooseTarget(outcome, targetPlayer.getGraveyard(), targetCardsHand, source, game);
|
||||
for(UUID cardId: targetCardsHand.getTargets()) {
|
||||
for (UUID cardId : targetCardsHand.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true);
|
||||
|
|
@ -158,7 +158,7 @@ class ReapIntellectEffect extends OneShotEffect {
|
|||
// search cards in Library
|
||||
TargetCardInLibrary targetCardsLibrary = new TargetCardInLibrary(0, Integer.MAX_VALUE, filterNamedCards);
|
||||
controller.searchLibrary(targetCardsLibrary, game, targetPlayer.getId());
|
||||
for(UUID cardId: targetCardsLibrary.getTargets()) {
|
||||
for (UUID cardId : targetCardsLibrary.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ import mage.game.stack.Spell;
|
|||
import mage.game.turn.TurnMod;
|
||||
import mage.players.Player;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
@ -57,8 +56,7 @@ import mage.players.Player;
|
|||
public class SearchTheCity extends CardImpl {
|
||||
|
||||
public SearchTheCity(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}");
|
||||
|
||||
// When Search the City enters the battlefield, exile the top five cards of your library.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchTheCityExileEffect()));
|
||||
|
|
@ -78,7 +76,6 @@ public class SearchTheCity extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class SearchTheCityExileEffect extends OneShotEffect {
|
||||
|
||||
public SearchTheCityExileEffect() {
|
||||
|
|
@ -96,7 +93,7 @@ class SearchTheCityExileEffect extends OneShotEffect {
|
|||
if (player != null) {
|
||||
// move cards from library to exile
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (player != null && player.getLibrary().hasCards()) {
|
||||
if (player.getLibrary().hasCards()) {
|
||||
Card topCard = player.getLibrary().getFromTop(game);
|
||||
topCard.moveToExile(source.getSourceId(), "Cards exiled by Search the City", source.getSourceId(), game);
|
||||
}
|
||||
|
|
@ -112,7 +109,6 @@ class SearchTheCityExileEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class SearchTheCityTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public SearchTheCityTriggeredAbility() {
|
||||
|
|
@ -151,7 +147,7 @@ class SearchTheCityTriggeredAbility extends TriggeredAbilityImpl {
|
|||
filter.add(new NamePredicate(cardName));
|
||||
|
||||
if (searchTheCityExileZone.count(filter, game) > 0) {
|
||||
this.getEffects().get(0).setValue("cardName",cardName);
|
||||
this.getEffects().get(0).setValue("cardName", cardName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -170,12 +166,11 @@ class SearchTheCityTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class SearchTheCityExiledCardToHandEffect extends OneShotEffect {
|
||||
|
||||
public SearchTheCityExiledCardToHandEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
staticText = "you may put one of those cards with that name into its owner's hand. Then if there are no cards exiled with Search the City, sacrifice it. If you do, take an extra turn after this one";
|
||||
staticText = "you may put one of those cards with that name into its owner's hand. Then if there are no cards exiled with {this}, sacrifice it. If you do, take an extra turn after this one";
|
||||
}
|
||||
|
||||
public SearchTheCityExiledCardToHandEffect(final SearchTheCityExiledCardToHandEffect effect) {
|
||||
|
|
@ -187,7 +182,7 @@ class SearchTheCityExiledCardToHandEffect extends OneShotEffect {
|
|||
String cardName = (String) this.getValue("cardName");
|
||||
ExileZone searchTheCityExileZone = game.getExile().getExileZone(source.getSourceId());
|
||||
if (cardName != null && searchTheCityExileZone != null) {
|
||||
for (Card card :searchTheCityExileZone.getCards(game)) {
|
||||
for (Card card : searchTheCityExileZone.getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (card.moveToZone(Zone.HAND, source.getSourceId(), game, true)) {
|
||||
game.informPlayers("Search the City: put " + card.getName() + " into owner's hand");
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -98,7 +99,8 @@ class SecretSalvageEffect extends OneShotEffect {
|
|||
if (targetCard != null) {
|
||||
controller.moveCards(targetCard, Zone.EXILED, source, game);
|
||||
FilterCard nameFilter = new FilterCard();
|
||||
nameFilter.add(new NamePredicate(targetCard.getName()));
|
||||
String nameToSearch = targetCard.isSplitCard() ? ((SplitCard) targetCard).getLeftHalfCard().getName() : targetCard.getName();
|
||||
nameFilter.add(new NamePredicate(nameToSearch));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, Integer.MAX_VALUE, nameFilter);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import mage.abilities.keyword.FlyingAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -57,7 +58,7 @@ import mage.target.common.TargetCardInLibrary;
|
|||
public class ShimianSpecter extends CardImpl {
|
||||
|
||||
public ShimianSpecter(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
|
||||
this.subtype.add("Specter");
|
||||
|
||||
this.power = new MageInt(2);
|
||||
|
|
@ -118,11 +119,11 @@ class ShimianSpecterEffect extends OneShotEffect {
|
|||
// Exile all cards with the same name
|
||||
// Building a card filter with the name
|
||||
FilterCard filterNamedCards = new FilterCard();
|
||||
String nameToSearch = "---";// so no card matches
|
||||
if (chosenCard != null) {
|
||||
filterNamedCards.add(new NamePredicate(chosenCard.getName()));
|
||||
} else {
|
||||
filterNamedCards.add(new NamePredicate("----")); // so no card matches
|
||||
nameToSearch = chosenCard.isSplitCard() ? ((SplitCard) chosenCard).getLeftHalfCard().getName() : chosenCard.getName();
|
||||
}
|
||||
filterNamedCards.add(new NamePredicate(nameToSearch));
|
||||
|
||||
// The cards you're searching for must be found and exiled if they're in the graveyard because it's a public zone.
|
||||
// Finding those cards in the hand and library is optional, because those zones are hidden (even if the hand is temporarily revealed).
|
||||
|
|
@ -137,7 +138,7 @@ class ShimianSpecterEffect extends OneShotEffect {
|
|||
// search cards in hand
|
||||
TargetCardInHand targetHandCards = new TargetCardInHand(0, Integer.MAX_VALUE, filterNamedCards);
|
||||
controller.chooseTarget(outcome, targetPlayer.getHand(), targetHandCards, source, game);
|
||||
for(UUID cardId: targetHandCards.getTargets()) {
|
||||
for (UUID cardId : targetHandCards.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true);
|
||||
|
|
@ -150,7 +151,7 @@ class ShimianSpecterEffect extends OneShotEffect {
|
|||
if (chosenCard != null || controller.chooseUse(outcome, "Search library anyway?", source, game)) {
|
||||
TargetCardInLibrary targetCardsLibrary = new TargetCardInLibrary(0, Integer.MAX_VALUE, filterNamedCards);
|
||||
controller.searchLibrary(targetCardsLibrary, game, targetPlayer.getId());
|
||||
for(UUID cardId: targetCardsLibrary.getTargets()) {
|
||||
for (UUID cardId : targetCardsLibrary.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ import java.util.HashSet;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
|
@ -44,6 +42,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterNonlandCard;
|
||||
|
|
@ -59,7 +59,7 @@ import mage.target.common.TargetCardInHand;
|
|||
public class SphinxOfTheChimes extends CardImpl {
|
||||
|
||||
public SphinxOfTheChimes(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
|
||||
this.subtype.add("Sphinx");
|
||||
|
||||
this.power = new MageInt(5);
|
||||
|
|
@ -128,19 +128,17 @@ class TargetTwoNonLandCardsWithSameNameInHand extends TargetCardInHand {
|
|||
Card chosenCard = cardsToCheck.get(entry.getKey(), game);
|
||||
if (chosenCard != null) {
|
||||
for (UUID cardToCheck : cardsToCheck) {
|
||||
if (!cardToCheck.equals(chosenCard.getId()) && chosenCard.getName().equals(game.getCard(cardToCheck).getName()))
|
||||
{
|
||||
if (!cardToCheck.equals(chosenCard.getId()) && chosenCard.getName().equals(game.getCard(cardToCheck).getName())) {
|
||||
newPossibleTargets.add(cardToCheck);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
for (UUID cardToCheck : cardsToCheck) {
|
||||
FilterCard nameFilter = new FilterCard();
|
||||
nameFilter.add(new NamePredicate(game.getCard(cardToCheck).getName()));
|
||||
Card card = game.getCard(cardToCheck);
|
||||
nameFilter.add(new NamePredicate(card.isSplitCard() ? ((SplitCard) card).getLeftHalfCard().getName() : card.getName()));
|
||||
if (cardsToCheck.count(nameFilter, game) > 1) {
|
||||
newPossibleTargets.add(cardToCheck);
|
||||
}
|
||||
|
|
@ -149,7 +147,6 @@ class TargetTwoNonLandCardsWithSameNameInHand extends TargetCardInHand {
|
|||
return newPossibleTargets;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||
Cards cardsToCheck = new CardsImpl();
|
||||
|
|
@ -158,9 +155,9 @@ class TargetTwoNonLandCardsWithSameNameInHand extends TargetCardInHand {
|
|||
cardsToCheck.add(card.getId());
|
||||
}
|
||||
int possibleCards = 0;
|
||||
for (UUID cardToCheck : cardsToCheck) {
|
||||
for (Card card : cardsToCheck.getCards(game)) {
|
||||
FilterCard nameFilter = new FilterCard();
|
||||
nameFilter.add(new NamePredicate(game.getCard(cardToCheck).getName()));
|
||||
nameFilter.add(new NamePredicate(card.isSplitCard() ? ((SplitCard) card).getLeftHalfCard().getName() : card.getName()));
|
||||
if (cardsToCheck.count(nameFilter, game) > 1) {
|
||||
++possibleCards;
|
||||
}
|
||||
|
|
@ -180,7 +177,7 @@ class TargetTwoNonLandCardsWithSameNameInHand extends TargetCardInHand {
|
|||
}
|
||||
} else {
|
||||
FilterCard nameFilter = new FilterCard();
|
||||
nameFilter.add(new NamePredicate(card.getName()));
|
||||
nameFilter.add(new NamePredicate(card.isSplitCard() ? ((SplitCard) card).getLeftHalfCard().getName() : card.getName()));
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player.getHand().getCards(nameFilter, game).size() > 1) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -51,23 +51,21 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public class StrataScythe extends CardImpl {
|
||||
|
||||
public StrataScythe (UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
|
||||
public StrataScythe(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
this.subtype.add("Equipment");
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new StrataScytheImprintEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(SameNameAsExiledCountValue.getInstance(), SameNameAsExiledCountValue.getInstance())));
|
||||
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3)));
|
||||
}
|
||||
|
||||
public StrataScythe (final StrataScythe card) {
|
||||
public StrataScythe(final StrataScythe card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
@ -79,6 +77,7 @@ public class StrataScythe extends CardImpl {
|
|||
}
|
||||
|
||||
class StrataScytheImprintEffect extends OneShotEffect {
|
||||
|
||||
StrataScytheImprintEffect() {
|
||||
super(Outcome.Exile);
|
||||
staticText = "search your library for a land card, exile it, then shuffle your library";
|
||||
|
|
@ -91,8 +90,9 @@ class StrataScytheImprintEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null)
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterLandCard());
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
|
|
@ -119,7 +119,8 @@ class StrataScytheImprintEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
class SameNameAsExiledCountValue implements DynamicValue {
|
||||
private static SameNameAsExiledCountValue instance = new SameNameAsExiledCountValue();
|
||||
|
||||
private static final SameNameAsExiledCountValue instance = new SameNameAsExiledCountValue();
|
||||
|
||||
public static SameNameAsExiledCountValue getInstance() {
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
*/
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.*;
|
||||
|
|
@ -45,9 +47,6 @@ import mage.target.common.TargetCardInGraveyard;
|
|||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
|
|
@ -61,7 +60,7 @@ public class SurgicalExtraction extends CardImpl {
|
|||
}
|
||||
|
||||
public SurgicalExtraction(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B/P}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B/P}");
|
||||
|
||||
// Choose target card in a graveyard other than a basic land card. Search its owner's graveyard,
|
||||
// hand, and library for any number of cards with the same name as that card and exile them.
|
||||
|
|
@ -107,16 +106,14 @@ class SurgicalExtractionEffect extends OneShotEffect {
|
|||
if (chosenCard != null && controller != null) {
|
||||
Player owner = game.getPlayer(chosenCard.getOwnerId());
|
||||
if (owner != null) {
|
||||
FilterCard filterNamedCard = new FilterCard("card named " + chosenCard.getName());
|
||||
filterNamedCard.add(new NamePredicate(chosenCard.getName()));
|
||||
|
||||
Cards cardsInLibrary = new CardsImpl();
|
||||
cardsInLibrary.addAll(owner.getLibrary().getCards(game));
|
||||
String nameToSearch = chosenCard.isSplitCard() ? ((SplitCard) chosenCard).getLeftHalfCard().getName() : chosenCard.getName();
|
||||
FilterCard filterNamedCard = new FilterCard("card named " + nameToSearch);
|
||||
filterNamedCard.add(new NamePredicate(nameToSearch));
|
||||
|
||||
// cards in Graveyard
|
||||
int cardsCount = owner.getGraveyard().count(filterNamedCard, game);
|
||||
if (cardsCount > 0) {
|
||||
filterNamedCard.setMessage("card named " + chosenCard.getName() + " in the graveyard of " + owner.getName());
|
||||
filterNamedCard.setMessage("card named " + nameToSearch + " in the graveyard of " + owner.getName());
|
||||
TargetCardInGraveyard target = new TargetCardInGraveyard(0, cardsCount, filterNamedCard);
|
||||
if (controller.chooseTarget(Outcome.Exile, owner.getGraveyard(), target, source, game)) {
|
||||
List<UUID> targets = target.getTargets();
|
||||
|
|
@ -130,7 +127,7 @@ class SurgicalExtractionEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
// cards in Hand
|
||||
filterNamedCard.setMessage("card named " + chosenCard.getName() + " in the hand of " + owner.getName());
|
||||
filterNamedCard.setMessage("card named " + nameToSearch + " in the hand of " + owner.getName());
|
||||
TargetCardInHand targetCardInHand = new TargetCardInHand(0, Integer.MAX_VALUE, filterNamedCard);
|
||||
if (controller.chooseTarget(Outcome.Exile, owner.getHand(), targetCardInHand, source, game)) {
|
||||
List<UUID> targets = targetCardInHand.getTargets();
|
||||
|
|
@ -143,7 +140,7 @@ class SurgicalExtractionEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
// cards in Library
|
||||
filterNamedCard.setMessage("card named " + chosenCard.getName() + " in the library of " + owner.getName());
|
||||
filterNamedCard.setMessage("card named " + nameToSearch + " in the library of " + owner.getName());
|
||||
TargetCardInLibrary targetCardInLibrary = new TargetCardInLibrary(0, Integer.MAX_VALUE, filterNamedCard);
|
||||
if (controller.searchLibrary(targetCardInLibrary, game, owner.getId())) {
|
||||
List<UUID> targets = targetCardInLibrary.getTargets();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.mage.test.cards.abilities.oneshot.exile;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SurgicalExtractionTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* I noticed that surgical extraction did not allow me to select any cards
|
||||
* to exile when I targeted breaking // entering. It did however allow my
|
||||
* opponent to target lingering souls so it could be a split card
|
||||
* interaction or just a random glitch.
|
||||
*/
|
||||
@Test
|
||||
public void testSearchAndExileSplitCards() {
|
||||
// Choose target card in a graveyard other than a basic land card. Search its owner's graveyard,
|
||||
// hand, and library for any number of cards with the same name as that card and exile them.
|
||||
// Then that player shuffles his or her library.
|
||||
addCard(Zone.HAND, playerA, "Surgical Extraction", 1); // Instant {B/P}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
addCard(Zone.GRAVEYARD, playerB, "Breaking // Entering", 2);
|
||||
addCard(Zone.HAND, playerB, "Breaking // Entering", 1);
|
||||
addCard(Zone.LIBRARY, playerB, "Breaking // Entering", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Surgical Extraction", "Breaking // Entering");
|
||||
|
||||
addTarget(playerA, "Breaking // Entering^Breaking // Entering");
|
||||
addTarget(playerA, "Breaking // Entering");
|
||||
setChoice(playerA, "Breaking // Entering");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Surgical Extraction", 1);
|
||||
|
||||
assertGraveyardCount(playerB, "Breaking // Entering", 0);
|
||||
assertLibraryCount(playerB, "Breaking // Entering", 0);
|
||||
assertHandCount(playerB, "Breaking // Entering", 0);
|
||||
|
||||
assertExileCount(playerB, "Breaking // Entering", 4);
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue