From c0c60c47c63ac06a159f05ba9b077552bec2c21a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 13 Apr 2020 18:51:59 -0400 Subject: [PATCH] Implemented Auspicious Starrix --- .../src/mage/cards/a/AuspiciousStarrix.java | 90 +++++++++++++++++++ .../src/mage/sets/IkoriaLairOfBehemoths.java | 1 + 2 files changed, 91 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AuspiciousStarrix.java diff --git a/Mage.Sets/src/mage/cards/a/AuspiciousStarrix.java b/Mage.Sets/src/mage/cards/a/AuspiciousStarrix.java new file mode 100644 index 0000000000..e183749608 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AuspiciousStarrix.java @@ -0,0 +1,90 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.MutatesSourceTriggeredAbility; +import mage.abilities.dynamicvalue.common.SourceMutatedCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.MutateAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AuspiciousStarrix extends CardImpl { + + public AuspiciousStarrix(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); + + this.subtype.add(SubType.ELK); + this.subtype.add(SubType.BEAST); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Mutate {5}{G} + this.addAbility(new MutateAbility(this, "{5}{G}")); + + // Whenever this creature mutates, exile cards from the top of your library until you exile X permanent cards, where X is the number of times this creature has mutated. Put those permanent cards onto the battlefield. + this.addAbility(new MutatesSourceTriggeredAbility(new AuspiciousStarrixEffect())); + } + + private AuspiciousStarrix(final AuspiciousStarrix card) { + super(card); + } + + @Override + public AuspiciousStarrix copy() { + return new AuspiciousStarrix(this); + } +} + +class AuspiciousStarrixEffect extends OneShotEffect { + + AuspiciousStarrixEffect() { + super(Outcome.Benefit); + staticText = "exile cards from the top of your library until you exile X permanent cards, " + + "where X is the number of times this creature has mutated. " + + "Put those permanent cards onto the battlefield."; + } + + private AuspiciousStarrixEffect(final AuspiciousStarrixEffect effect) { + super(effect); + } + + @Override + public AuspiciousStarrixEffect copy() { + return new AuspiciousStarrixEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int xValue = SourceMutatedCount.instance.calculate(game, source, this); + int count = 0; + Cards toExile = new CardsImpl(); + Cards toBattlefield = new CardsImpl(); + for (Card card : player.getLibrary().getCards(game)) { + if (card != null && card.isPermanent()) { + toBattlefield.add(card); + count++; + } + toExile.add(card); + if (count >= xValue) { + break; + } + } + player.moveCards(toExile, Zone.EXILED, source, game); + return player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index 6b7769fd7e..8c34ca792d 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -69,6 +69,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Almighty Brushwagg", 143, Rarity.COMMON, mage.cards.a.AlmightyBrushwagg.class)); cards.add(new SetCardInfo("Anticipate", 40, Rarity.COMMON, mage.cards.a.Anticipate.class)); cards.add(new SetCardInfo("Archipelagore", 41, Rarity.UNCOMMON, mage.cards.a.Archipelagore.class)); + cards.add(new SetCardInfo("Auspicious Starrix", 144, Rarity.UNCOMMON, mage.cards.a.AuspiciousStarrix.class)); cards.add(new SetCardInfo("Avian Oddity", 42, Rarity.UNCOMMON, mage.cards.a.AvianOddity.class)); cards.add(new SetCardInfo("Barrier Breach", 145, Rarity.UNCOMMON, mage.cards.b.BarrierBreach.class)); cards.add(new SetCardInfo("Bastion of Remembrance", 73, Rarity.UNCOMMON, mage.cards.b.BastionOfRemembrance.class));