diff --git a/Mage.Sets/src/mage/cards/g/GethsSummons.java b/Mage.Sets/src/mage/cards/g/GethsSummons.java new file mode 100644 index 00000000000..d9b2d11d498 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GethsSummons.java @@ -0,0 +1,119 @@ +package mage.cards.g; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.card.OwnerIdPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCardInOpponentsGraveyard; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.targetadjustment.TargetAdjuster; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class GethsSummons extends CardImpl { + + public GethsSummons(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{B}"); + + // Return up to one target creature card from your graveyard to the battlefield. + // + // Corrupted — For each opponent who has three or more poison counters as you cast this spell, put up + // to one target creature card from that player's graveyard onto the battlefield under your control. + this.getSpellAbility().addEffect(new GethsSummonsEffect()); + this.getSpellAbility().setTargetAdjuster(GethsSummonsAdjuster.instance); + } + + private GethsSummons(final GethsSummons card) { + super(card); + } + + @Override + public GethsSummons copy() { + return new GethsSummons(this); + } +} + +enum GethsSummonsAdjuster implements TargetAdjuster { + instance; + + @Override + public void adjustTargets(Ability ability, Game game) { + ability.getTargets().clear(); + + // up to one target creature card from your graveyard + Target target = new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD); + ability.addTarget(target); + + // corrupted opponents' graveyards + for (UUID opponentId : game.getOpponents(ability.getControllerId(), true)) { + Player opponent = game.getPlayer(opponentId); + if (opponent == null || opponent.getCounters().getCount(CounterType.POISON) < 3) { + continue; + } + FilterCard filter = new FilterCard("creature card from " + opponent.getLogName() + "'s graveyard"); + filter.add(new OwnerIdPredicate(opponentId)); + filter.add(CardType.CREATURE.getPredicate()); + target = new TargetCardInOpponentsGraveyard(0, 1, filter); + ability.addTarget(target); + } + } +} + +class GethsSummonsEffect extends OneShotEffect { + + public GethsSummonsEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "Return up to one target creature card from your graveyard to the battlefield.
" + + AbilityWord.CORRUPTED.formatWord() + "For each opponent who has three or more poison counters " + + "as you cast this spell, put up to one target creature card from that player's graveyard onto " + + "the battlefield under your control"; + } + + public GethsSummonsEffect(final GethsSummonsEffect effect) { + super(effect); + } + + @Override + public GethsSummonsEffect copy() { + return new GethsSummonsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + Set cardsToBattlefield = new HashSet<>(); + for (Target target : source.getTargets()) { + if (target instanceof TargetCardInYourGraveyard || target instanceof TargetCardInOpponentsGraveyard) { + Card targetCard = game.getCard(target.getFirstTarget()); + if (targetCard != null) { + cardsToBattlefield.add(targetCard); + } + } + } + if (!cardsToBattlefield.isEmpty()) { + controller.moveCards(cardsToBattlefield, Zone.BATTLEFIELD, source, game); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOneCommander.java b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOneCommander.java index 4e389251c82..a91f8ea5a27 100644 --- a/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOneCommander.java +++ b/Mage.Sets/src/mage/sets/PhyrexiaAllWillBeOneCommander.java @@ -61,6 +61,8 @@ public final class PhyrexiaAllWillBeOneCommander extends ExpansionSet { cards.add(new SetCardInfo("Fumigate", 69, Rarity.RARE, mage.cards.f.Fumigate.class)); cards.add(new SetCardInfo("Furycalm Snarl", 155, Rarity.RARE, mage.cards.f.FurycalmSnarl.class)); cards.add(new SetCardInfo("Generous Gift", 70, Rarity.UNCOMMON, mage.cards.g.GenerousGift.class)); + cards.add(new SetCardInfo("Geth's Summons", 11, Rarity.RARE, mage.cards.g.GethsSummons.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Geth's Summons", 49, Rarity.RARE, mage.cards.g.GethsSummons.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ghostly Prison", 71, Rarity.UNCOMMON, mage.cards.g.GhostlyPrison.class)); cards.add(new SetCardInfo("Glimmer Lens", 6, Rarity.RARE, mage.cards.g.GlimmerLens.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Glimmer Lens", 44, Rarity.RARE, mage.cards.g.GlimmerLens.class, NON_FULL_USE_VARIOUS)); @@ -93,6 +95,8 @@ public final class PhyrexiaAllWillBeOneCommander extends ExpansionSet { cards.add(new SetCardInfo("Legion Warboss", 101, Rarity.RARE, mage.cards.l.LegionWarboss.class)); cards.add(new SetCardInfo("Loxodon Warhammer", 135, Rarity.RARE, mage.cards.l.LoxodonWarhammer.class)); cards.add(new SetCardInfo("Loyal Apprentice", 102, Rarity.UNCOMMON, mage.cards.l.LoyalApprentice.class)); + cards.add(new SetCardInfo("Lux Artillery", 27, Rarity.RARE, mage.cards.l.LuxArtillery.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Lux Artillery", 41, Rarity.RARE, mage.cards.l.LuxArtillery.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Mace of the Valiant", 78, Rarity.RARE, mage.cards.m.MaceOfTheValiant.class)); cards.add(new SetCardInfo("Martial Coup", 79, Rarity.RARE, mage.cards.m.MartialCoup.class)); cards.add(new SetCardInfo("Mask of Memory", 136, Rarity.UNCOMMON, mage.cards.m.MaskOfMemory.class));