[STX] Implemented Quandrix Command

This commit is contained in:
Evan Kranzler 2021-02-19 09:08:14 -05:00
parent 4db47adc19
commit 223c576359
10 changed files with 209 additions and 428 deletions

View file

@ -1,36 +1,26 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.effects.common.TargetPlayerShufflesTargetCardsEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetCardInTargetPlayersGraveyard;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class DwellOnThePast extends CardImpl {
public DwellOnThePast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}");
// Target player shuffles up to four target cards from their graveyard into their library.
this.getSpellAbility().addEffect(new DwellOnThePastEffect());
this.getSpellAbility().addEffect(new TargetPlayerShufflesTargetCardsEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new DwellOnThePastTarget());
this.getSpellAbility().addTarget(new TargetCardInTargetPlayersGraveyard(4));
}
private DwellOnThePast(final DwellOnThePast card) {
@ -42,57 +32,3 @@ public final class DwellOnThePast extends CardImpl {
return new DwellOnThePast(this);
}
}
class DwellOnThePastEffect extends OneShotEffect {
public DwellOnThePastEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to four target cards from their graveyard into their library";
}
public DwellOnThePastEffect(final DwellOnThePastEffect effect) {
super(effect);
}
@Override
public DwellOnThePastEffect copy() {
return new DwellOnThePastEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getFirstTarget());
if (controller != null) {
return controller.shuffleCardsToLibrary(new CardsImpl(source.getTargets().get(1).getTargets()), game, source);
}
return false;
}
}
class DwellOnThePastTarget extends TargetCardInGraveyard {
public DwellOnThePastTarget() {
super(0, 4, new FilterCard("cards from target player's graveyard"));
}
public DwellOnThePastTarget(final DwellOnThePastTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public DwellOnThePastTarget copy() {
return new DwellOnThePastTarget(this);
}
}

View file

@ -1,37 +1,34 @@
package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.ZoneChangeTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.Card;
import mage.abilities.effects.common.TargetPlayerShufflesTargetCardsEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetCardInTargetPlayersGraveyard;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class GaeasBlessing extends CardImpl {
public GaeasBlessing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Target player shuffles up to three target cards from their graveyard into their library.
this.getSpellAbility().addEffect(new GaeasBlessingEffect());
this.getSpellAbility().addEffect(new TargetPlayerShufflesTargetCardsEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new GaeasBlessingTarget());
this.getSpellAbility().addTarget(new TargetCardInTargetPlayersGraveyard(3));
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
@ -50,67 +47,13 @@ public final class GaeasBlessing extends CardImpl {
}
}
class GaeasBlessingEffect extends OneShotEffect {
public GaeasBlessingEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to three target cards from their graveyard into their library";
}
public GaeasBlessingEffect(final GaeasBlessingEffect effect) {
super(effect);
}
@Override
public GaeasBlessingEffect copy() {
return new GaeasBlessingEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
return targetPlayer.shuffleCardsToLibrary(new CardsImpl(source.getTargets().get(1).getTargets()), game, source);
}
return false;
}
}
class GaeasBlessingTarget extends TargetCardInGraveyard {
public GaeasBlessingTarget() {
super(0, 3, new FilterCard());
}
public GaeasBlessingTarget(final GaeasBlessingTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public GaeasBlessingTarget copy() {
return new GaeasBlessingTarget(this);
}
}
class GaeasBlessingTriggeredAbility extends ZoneChangeTriggeredAbility {
public GaeasBlessingTriggeredAbility() {
GaeasBlessingTriggeredAbility() {
super(Zone.LIBRARY, Zone.GRAVEYARD, new GaeasBlessingGraveToLibraryEffect(), "", false);
}
public GaeasBlessingTriggeredAbility(final GaeasBlessingTriggeredAbility ability) {
private GaeasBlessingTriggeredAbility(final GaeasBlessingTriggeredAbility ability) {
super(ability);
}
@ -127,12 +70,12 @@ class GaeasBlessingTriggeredAbility extends ZoneChangeTriggeredAbility {
class GaeasBlessingGraveToLibraryEffect extends OneShotEffect {
public GaeasBlessingGraveToLibraryEffect() {
GaeasBlessingGraveToLibraryEffect() {
super(Outcome.GainLife);
staticText = "shuffle your graveyard into your library";
}
public GaeasBlessingGraveToLibraryEffect(final GaeasBlessingGraveToLibraryEffect effect) {
private GaeasBlessingGraveToLibraryEffect(final GaeasBlessingGraveToLibraryEffect effect) {
super(effect);
}

View file

@ -1,38 +1,29 @@
package mage.cards.k;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.TargetPlayerShufflesTargetCardsEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetCardInTargetPlayersGraveyard;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class KrosanReclamation extends CardImpl {
public KrosanReclamation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}");
// Target player shuffles up to two target cards from their graveyard into their library.
this.getSpellAbility().addEffect(new KrosanReclamationEffect());
this.getSpellAbility().addEffect(new TargetPlayerShufflesTargetCardsEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new KrosanReclamationTarget());
this.getSpellAbility().addTarget(new TargetCardInTargetPlayersGraveyard(2));
// Flashback {1}{G}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{1}{G}"), TimingRule.INSTANT));
@ -47,57 +38,3 @@ public final class KrosanReclamation extends CardImpl {
return new KrosanReclamation(this);
}
}
class KrosanReclamationEffect extends OneShotEffect {
public KrosanReclamationEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to two target cards from their graveyard into their library";
}
public KrosanReclamationEffect(final KrosanReclamationEffect effect) {
super(effect);
}
@Override
public KrosanReclamationEffect copy() {
return new KrosanReclamationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
return targetPlayer.shuffleCardsToLibrary(new CardsImpl(source.getTargets().get(1).getTargets()), game, source);
}
return false;
}
}
class KrosanReclamationTarget extends TargetCardInGraveyard {
public KrosanReclamationTarget() {
super(0, 2, new FilterCard());
}
public KrosanReclamationTarget(final KrosanReclamationTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public KrosanReclamationTarget copy() {
return new KrosanReclamationTarget(this);
}
}

View file

@ -1,28 +1,19 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.effects.common.TargetPlayerShufflesTargetCardsEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetCardInTargetPlayersGraveyard;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class LoamingShaman extends CardImpl {
@ -36,9 +27,9 @@ public final class LoamingShaman extends CardImpl {
this.toughness = new MageInt(2);
// When Loaming Shaman enters the battlefield, target player shuffles any number of target cards from their graveyard into their library.
Ability ability = new EntersBattlefieldTriggeredAbility(new LoamingShamanEffect(), false);
Ability ability = new EntersBattlefieldTriggeredAbility(new TargetPlayerShufflesTargetCardsEffect(), false);
ability.addTarget(new TargetPlayer());
ability.addTarget(new LoamingShamanTargetCardsInGraveyard(0, Integer.MAX_VALUE, new FilterCard("cards in target player's graveyard")));
ability.addTarget(new TargetCardInTargetPlayersGraveyard(Integer.MAX_VALUE));
this.addAbility(ability);
}
@ -51,65 +42,3 @@ public final class LoamingShaman extends CardImpl {
return new LoamingShaman(this);
}
}
class LoamingShamanEffect extends OneShotEffect {
public LoamingShamanEffect() {
super(Outcome.Benefit);
this.staticText = "target player shuffles any number of target cards from their graveyard into their library";
}
public LoamingShamanEffect(final LoamingShamanEffect effect) {
super(effect);
}
@Override
public LoamingShamanEffect copy() {
return new LoamingShamanEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
Cards cards = new CardsImpl(source.getTargets().get(1).getTargets());
targetPlayer.moveCards(cards, Zone.LIBRARY, source, game);
targetPlayer.shuffleLibrary(source, game);
return true;
}
return false;
}
}
class LoamingShamanTargetCardsInGraveyard extends TargetCardInGraveyard {
public LoamingShamanTargetCardsInGraveyard(int minNumTargets, int maxNumTargets, FilterCard filter) {
super(minNumTargets, maxNumTargets, filter);
}
public LoamingShamanTargetCardsInGraveyard(final LoamingShamanTargetCardsInGraveyard target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
UUID targetPlayerId = source.getFirstTarget();
UUID firstTarget = this.getFirstTarget();
Card targetCard = game.getCard(id);
if (firstTarget != null) {
Card card = game.getCard(firstTarget);
if (card == null || targetCard == null
|| !card.isOwnedBy(targetCard.getOwnerId())) {
return false;
}
} else if (targetCard == null || !targetCard.isOwnedBy(targetPlayerId)) {
return false;
}
return super.canTarget(id, source, game);
}
@Override
public LoamingShamanTargetCardsInGraveyard copy() {
return new LoamingShamanTargetCardsInGraveyard(this);
}
}

View file

@ -1,38 +1,30 @@
package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.TargetPlayerShufflesTargetCardsEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetCardInTargetPlayersGraveyard;
import java.util.UUID;
/**
*
* @author North
*/
public final class MemorysJourney extends CardImpl {
public MemorysJourney(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Target player shuffles up to three target cards from their graveyard into their library.
this.getSpellAbility().addEffect(new MemorysJourneyEffect());
this.getSpellAbility().addEffect(new TargetPlayerShufflesTargetCardsEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new MemorysJourneyTarget());
this.getSpellAbility().addTarget(new TargetCardInTargetPlayersGraveyard(3));
// Flashback {G}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{G}"), TimingRule.INSTANT));
}
@ -46,57 +38,3 @@ public final class MemorysJourney extends CardImpl {
return new MemorysJourney(this);
}
}
class MemorysJourneyEffect extends OneShotEffect {
public MemorysJourneyEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to three target cards from their graveyard into their library";
}
public MemorysJourneyEffect(final MemorysJourneyEffect effect) {
super(effect);
}
@Override
public MemorysJourneyEffect copy() {
return new MemorysJourneyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
return targetPlayer.shuffleCardsToLibrary(new CardsImpl(source.getTargets().get(1).getTargets()), game, source);
}
return false;
}
}
class MemorysJourneyTarget extends TargetCardInGraveyard {
public MemorysJourneyTarget() {
super(0, 3, new FilterCard());
}
public MemorysJourneyTarget(final MemorysJourneyTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public MemorysJourneyTarget copy() {
return new MemorysJourneyTarget(this);
}
}

View file

@ -0,0 +1,72 @@
package mage.cards.q;
import mage.abilities.Mode;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.effects.common.TargetPlayerShufflesTargetCardsEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.target.TargetPlayer;
import mage.target.TargetSpell;
import mage.target.common.TargetCardInTargetPlayersGraveyard;
import mage.target.common.TargetCreatureOrPlaneswalker;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class QuandrixCommand extends CardImpl {
private static final FilterSpell filter = new FilterSpell("artifact or enchantment spell");
static {
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.ENCHANTMENT.getPredicate()
));
}
public QuandrixCommand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}{U}");
// Choose two
this.getSpellAbility().getModes().setMinModes(2);
this.getSpellAbility().getModes().setMaxModes(2);
// Return target creature or planeswalker to its owner's hand.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker());
// Counter target artifact or enchantment spell.
Mode mode = new Mode(new CounterTargetEffect());
mode.addTarget(new TargetSpell(filter));
this.getSpellAbility().addMode(mode);
// Put two +1/+1 counters on target creature.
mode = new Mode(new AddCountersTargetEffect(CounterType.P1P1.createInstance(2)));
mode.addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addMode(mode);
// Target player shuffles up to three target cards from their graveyard into their library.
mode = new Mode(new TargetPlayerShufflesTargetCardsEffect());
mode.addTarget(new TargetPlayer());
mode.addTarget(new TargetCardInTargetPlayersGraveyard(3));
this.getSpellAbility().addMode(mode);
}
private QuandrixCommand(final QuandrixCommand card) {
super(card);
}
@Override
public QuandrixCommand copy() {
return new QuandrixCommand(this);
}
}

View file

@ -1,25 +1,16 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.effects.common.TargetPlayerShufflesTargetCardsEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetCardInTargetPlayersGraveyard;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class StreamOfConsciousness extends CardImpl {
@ -29,10 +20,9 @@ public final class StreamOfConsciousness extends CardImpl {
this.subtype.add(SubType.ARCANE);
// Target player shuffles up to four target cards from their graveyard into their library.
this.getSpellAbility().addEffect(new StreamOfConsciousnessEffect());
this.getSpellAbility().addEffect(new TargetPlayerShufflesTargetCardsEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new StreamOfConsciousnessTarget());
this.getSpellAbility().addTarget(new TargetCardInTargetPlayersGraveyard(4));
}
private StreamOfConsciousness(final StreamOfConsciousness card) {
@ -44,59 +34,3 @@ public final class StreamOfConsciousness extends CardImpl {
return new StreamOfConsciousness(this);
}
}
class StreamOfConsciousnessEffect extends OneShotEffect {
public StreamOfConsciousnessEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to four target cards from their graveyard into their library";
}
public StreamOfConsciousnessEffect(final StreamOfConsciousnessEffect effect) {
super(effect);
}
@Override
public StreamOfConsciousnessEffect copy() {
return new StreamOfConsciousnessEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {
Cards targets = new CardsImpl(source.getTargets().get(1).getTargets());
targets.retainAll(player.getGraveyard());
return player.shuffleCardsToLibrary(targets, game, source);
}
return false;
}
}
class StreamOfConsciousnessTarget extends TargetCardInGraveyard {
public StreamOfConsciousnessTarget() {
super(0, 4, new FilterCard("cards from target player's graveyard"));
}
public StreamOfConsciousnessTarget(final StreamOfConsciousnessTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public StreamOfConsciousnessTarget copy() {
return new StreamOfConsciousnessTarget(this);
}
}

View file

@ -28,6 +28,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
this.maxCardNumberInBooster = 275;
cards.add(new SetCardInfo("Prismari Command", 214, Rarity.RARE, mage.cards.p.PrismariCommand.class));
cards.add(new SetCardInfo("Quandrix Command", 217, Rarity.RARE, mage.cards.q.QuandrixCommand.class));
cards.add(new SetCardInfo("Silverquill Command", 232, Rarity.RARE, mage.cards.s.SilverquillCommand.class));
}
}

View file

@ -0,0 +1,55 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
* @author TheElk801
*/
public class TargetPlayerShufflesTargetCardsEffect extends OneShotEffect {
public TargetPlayerShufflesTargetCardsEffect() {
super(Outcome.Neutral);
}
private TargetPlayerShufflesTargetCardsEffect(final TargetPlayerShufflesTargetCardsEffect effect) {
super(effect);
}
@Override
public TargetPlayerShufflesTargetCardsEffect copy() {
return new TargetPlayerShufflesTargetCardsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
Cards cards = new CardsImpl(source.getTargets().get(1).getTargets());
if (targetPlayer != null && !cards.isEmpty()) {
return targetPlayer.shuffleCardsToLibrary(cards, game, source);
}
return false;
}
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
String rule = "target player shuffles ";
int targetNumber = mode.getTargets().get(1).getMaxNumberOfTargets();
if (targetNumber == Integer.MAX_VALUE) {
rule += "any number of target cards";
} else {
rule += "up to " + CardUtil.numberToText(targetNumber, "one") + " target card" + (targetNumber > 1 ? "s" : "");
}
return rule + " from their graveyard into their library";
}
}

View file

@ -0,0 +1,36 @@
package mage.target.common;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.filter.StaticFilters;
import mage.game.Game;
import java.util.UUID;
/**
* @author TheElk801
*/
public class TargetCardInTargetPlayersGraveyard extends TargetCardInGraveyard {
public TargetCardInTargetPlayersGraveyard(int targets) {
super(0, targets, StaticFilters.FILTER_CARD);
}
private TargetCardInTargetPlayersGraveyard(final TargetCardInTargetPlayersGraveyard target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
if (!super.canTarget(id, source, game)) {
return false;
}
Card card = game.getCard(id);
return card != null && card.isOwnedBy(source.getFirstTarget());
}
@Override
public TargetCardInTargetPlayersGraveyard copy() {
return new TargetCardInTargetPlayersGraveyard(this);
}
}