From dd878118de4e340dd8f0118dd08c62b84d2ee5d2 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sat, 15 Apr 2023 19:10:46 -0400 Subject: [PATCH] [MOM] Implement Invasion of Tarkir / Defiant Thundermaw --- .../src/mage/cards/d/DefiantThundermaw.java | 90 +++++++++++++++++ .../src/mage/cards/i/InvasionOfTarkir.java | 99 +++++++++++++++++++ .../src/mage/sets/MarchOfTheMachine.java | 2 + 3 files changed, 191 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DefiantThundermaw.java create mode 100644 Mage.Sets/src/mage/cards/i/InvasionOfTarkir.java diff --git a/Mage.Sets/src/mage/cards/d/DefiantThundermaw.java b/Mage.Sets/src/mage/cards/d/DefiantThundermaw.java new file mode 100644 index 00000000000..761078b578f --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DefiantThundermaw.java @@ -0,0 +1,90 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.MageObjectReference; +import mage.abilities.Ability; +import mage.abilities.common.AttacksCreatureYouControlTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.target.common.TargetAnyTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DefiantThundermaw extends CardImpl { + + private static final FilterControlledCreaturePermanent filter + = new FilterControlledCreaturePermanent(SubType.DRAGON); + + public DefiantThundermaw(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, ""); + + this.subtype.add(SubType.DRAGON); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + this.color.setRed(true); + this.nightCard = true; + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever a Dragon you control attacks, it deals 2 damage to any target. + Ability ability = new AttacksCreatureYouControlTriggeredAbility( + new DefiantThundermawEffect(), false, filter + ); + ability.addTarget(new TargetAnyTarget()); + this.addAbility(ability); + } + + private DefiantThundermaw(final DefiantThundermaw card) { + super(card); + } + + @Override + public DefiantThundermaw copy() { + return new DefiantThundermaw(this); + } +} + +class DefiantThundermawEffect extends OneShotEffect { + + DefiantThundermawEffect() { + super(Outcome.Benefit); + staticText = "it deals 2 damage to any target"; + } + + private DefiantThundermawEffect(final DefiantThundermawEffect effect) { + super(effect); + } + + @Override + public DefiantThundermawEffect copy() { + return new DefiantThundermawEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + MageObjectReference mor = (MageObjectReference) getValue("attackerRef"); + if (mor == null) { + return false; + } + game.damagePlayerOrPlaneswalker( + getTargetPointer().getFirst(game, source), 2, + mor.getSourceId(), source, game, false, true + ); + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/i/InvasionOfTarkir.java b/Mage.Sets/src/mage/cards/i/InvasionOfTarkir.java new file mode 100644 index 00000000000..90a2d8592a1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/InvasionOfTarkir.java @@ -0,0 +1,99 @@ +package mage.cards.i; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SiegeAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; +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.filter.FilterCard; +import mage.filter.common.FilterAnyTarget; +import mage.filter.common.FilterPermanentOrPlayer; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInHand; +import mage.target.common.TargetPermanentOrPlayer; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class InvasionOfTarkir extends CardImpl { + + public InvasionOfTarkir(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.BATTLE}, "{1}{R}"); + + this.subtype.add(SubType.SIEGE); + this.setStartingDefense(5); + this.secondSideCardClazz = mage.cards.d.DefiantThundermaw.class; + + // (As a Siege enters, choose an opponent to protect it. You and others can attack it. When it's defeated, exile it, then cast it transformed.) + this.addAbility(new SiegeAbility()); + + // When Invasion of Tarkir enters the battlefield, reveal any number of Dragon cards from your hand. When you do, Invasion of Tarkir deals X plus 2 damage to any other target, where X is the number of cards revealed this way. + this.addAbility(new EntersBattlefieldTriggeredAbility(new InvasionOfTarkirEffect())); + } + + private InvasionOfTarkir(final InvasionOfTarkir card) { + super(card); + } + + @Override + public InvasionOfTarkir copy() { + return new InvasionOfTarkir(this); + } +} + +class InvasionOfTarkirEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard("Dragon cards"); + private static final FilterPermanentOrPlayer filter2 = new FilterAnyTarget("any other target"); + + static { + filter.add(SubType.DRAGON.getPredicate()); + filter2.getPermanentFilter().add(AnotherPredicate.instance); + } + + InvasionOfTarkirEffect() { + super(Outcome.Benefit); + staticText = "reveal any number of Dragon cards from your hand. When you do, " + + "{this} deals X plus 2 damage to any other target, where X is the number of cards revealed this way"; + } + + private InvasionOfTarkirEffect(final InvasionOfTarkirEffect effect) { + super(effect); + } + + @Override + public InvasionOfTarkirEffect copy() { + return new InvasionOfTarkirEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetCard target = new TargetCardInHand(0, Integer.MAX_VALUE, filter); + player.choose(Outcome.Benefit, player.getHand(), target, game); + Cards cards = new CardsImpl(target.getTargets()); + player.revealCards(source, cards, game); + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( + new DamageTargetEffect(cards.size() + 2), false + ); + ability.addTarget(new TargetPermanentOrPlayer(filter2)); + game.fireReflexiveTriggeredAbility(ability, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java index 2eef26742b6..3f693d0cf75 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java @@ -84,6 +84,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Cut Short", 10, Rarity.COMMON, mage.cards.c.CutShort.class)); cards.add(new SetCardInfo("Deadly Derision", 99, Rarity.COMMON, mage.cards.d.DeadlyDerision.class)); cards.add(new SetCardInfo("Deeproot Wayfinder", 184, Rarity.RARE, mage.cards.d.DeeprootWayfinder.class)); + cards.add(new SetCardInfo("Defiant Thundermaw", 149, Rarity.MYTHIC, mage.cards.d.DefiantThundermaw.class)); cards.add(new SetCardInfo("Deluge of the Dead", 115, Rarity.MYTHIC, mage.cards.d.DelugeOfTheDead.class)); cards.add(new SetCardInfo("Dismal Backwater", 269, Rarity.COMMON, mage.cards.d.DismalBackwater.class)); cards.add(new SetCardInfo("Disturbing Conversion", 54, Rarity.COMMON, mage.cards.d.DisturbingConversion.class)); @@ -174,6 +175,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Invasion of Ravnica", 1, Rarity.MYTHIC, mage.cards.i.InvasionOfRavnica.class)); cards.add(new SetCardInfo("Invasion of Segovia", 63, Rarity.RARE, mage.cards.i.InvasionOfSegovia.class)); cards.add(new SetCardInfo("Invasion of Shandalar", 193, Rarity.MYTHIC, mage.cards.i.InvasionOfShandalar.class)); + cards.add(new SetCardInfo("Invasion of Tarkir", 149, Rarity.MYTHIC, mage.cards.i.InvasionOfTarkir.class)); cards.add(new SetCardInfo("Invasion of Theros", 23, Rarity.RARE, mage.cards.i.InvasionOfTheros.class)); cards.add(new SetCardInfo("Invasion of Tolvada", 241, Rarity.RARE, mage.cards.i.InvasionOfTolvada.class)); cards.add(new SetCardInfo("Invasion of Ulgrotha", 116, Rarity.UNCOMMON, mage.cards.i.InvasionOfUlgrotha.class));