mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
- Fixed Shimian Specter
This commit is contained in:
parent
7923564f7c
commit
8e4080ce7c
1 changed files with 32 additions and 15 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -22,6 +21,7 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
|
@ -41,7 +41,10 @@ public final class ShimianSpecter extends CardImpl {
|
|||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever Shimian Specter deals combat damage to a player, that player reveals their hand. You choose a nonland card from it. Search that player's graveyard, hand, and library for all cards with the same name as that card and exile them. Then that player shuffles their library.
|
||||
// Whenever Shimian Specter deals combat damage to a player, that player
|
||||
// reveals their hand. You choose a nonland card from it. Search that player's
|
||||
// graveyard, hand, and library for all cards with the same name as that card
|
||||
// and exile them. Then that player shuffles their library.
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new ShimianSpecterEffect(), false, true));
|
||||
}
|
||||
|
||||
|
@ -65,7 +68,10 @@ class ShimianSpecterEffect extends OneShotEffect {
|
|||
|
||||
public ShimianSpecterEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "that player reveals their hand. You choose a nonland card from it. Search that player's graveyard, hand, and library for all cards with the same name as that card and exile them. Then that player shuffles their library";
|
||||
staticText = "that player reveals their hand. You choose a nonland card from it. "
|
||||
+ "Search that player's graveyard, hand, and library for all cards "
|
||||
+ "with the same name as that card and exile them. Then that "
|
||||
+ "player shuffles their library";
|
||||
}
|
||||
|
||||
public ShimianSpecterEffect(final ShimianSpecterEffect effect) {
|
||||
|
@ -77,16 +83,19 @@ class ShimianSpecterEffect extends OneShotEffect {
|
|||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (targetPlayer != null && sourceObject != null && controller != null) {
|
||||
if (targetPlayer != null
|
||||
&& sourceObject != null
|
||||
&& controller != null) {
|
||||
|
||||
// reveal hand of target player
|
||||
targetPlayer.revealCards(sourceObject.getName(), targetPlayer.getHand(), game);
|
||||
|
||||
// You choose a nonland card from it
|
||||
TargetCardInHand target = new TargetCardInHand(new FilterNonlandCard());
|
||||
TargetCard target = new TargetCard(Zone.HAND, new FilterNonlandCard());
|
||||
target.setNotTarget(true);
|
||||
Card chosenCard = null;
|
||||
if (controller.choose(Outcome.Benefit, targetPlayer.getHand(), target, game)) {
|
||||
if (target.canChoose(controller.getId(), game)
|
||||
&& controller.chooseTarget(Outcome.Benefit, targetPlayer.getHand(), target, source, game)) {
|
||||
chosenCard = game.getCard(target.getFirstTarget());
|
||||
}
|
||||
|
||||
|
@ -95,34 +104,42 @@ class ShimianSpecterEffect extends OneShotEffect {
|
|||
FilterCard filterNamedCards = new FilterCard();
|
||||
String nameToSearch = "---";// so no card matches
|
||||
if (chosenCard != null) {
|
||||
nameToSearch = chosenCard.isSplitCard() ? ((SplitCard) chosenCard).getLeftHalfCard().getName() : chosenCard.getName();
|
||||
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).
|
||||
// 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).
|
||||
// search cards in graveyard
|
||||
if (chosenCard != null) {
|
||||
for (Card checkCard : targetPlayer.getGraveyard().getCards(game)) {
|
||||
if (checkCard.getName().equals(chosenCard.getName())) {
|
||||
controller.moveCardToExileWithInfo(checkCard, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
|
||||
controller.moveCardToExileWithInfo(checkCard, null, "",
|
||||
source.getSourceId(), game, Zone.GRAVEYARD, true);
|
||||
}
|
||||
}
|
||||
|
||||
// search cards in hand
|
||||
TargetCardInHand targetHandCards = new TargetCardInHand(0, Integer.MAX_VALUE, filterNamedCards);
|
||||
controller.chooseTarget(outcome, targetPlayer.getHand(), targetHandCards, source, game);
|
||||
TargetCard targetHandCards = new TargetCard(0, Integer.MAX_VALUE, Zone.HAND, filterNamedCards);
|
||||
controller.chooseTarget(Outcome.Benefit, targetPlayer.getHand(), targetHandCards, source, game);
|
||||
for (UUID cardId : targetHandCards.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.HAND, true);
|
||||
controller.moveCardToExileWithInfo(card, null, "",
|
||||
source.getSourceId(), game, Zone.HAND, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// search cards in Library
|
||||
// If the player has no nonland cards in their hand, you can still search that player's library and have that player shuffle it.
|
||||
if (chosenCard != null || controller.chooseUse(outcome, "Search library anyway?", source, game)) {
|
||||
// If the player has no nonland cards in their hand, you can still search
|
||||
// that player's library and have that player shuffle it.
|
||||
if (chosenCard != null
|
||||
|| controller.chooseUse(outcome, "Search library anyway?", source, game)) {
|
||||
TargetCardInLibrary targetCardsLibrary = new TargetCardInLibrary(0, Integer.MAX_VALUE, filterNamedCards);
|
||||
controller.searchLibrary(targetCardsLibrary, source, game, targetPlayer.getId());
|
||||
for (UUID cardId : targetCardsLibrary.getTargets()) {
|
||||
|
|
Loading…
Reference in a new issue