From 79093388b232aadd47df71feedf4a1253e444455 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Fri, 2 Jun 2023 19:23:13 -0400 Subject: [PATCH] [LTR] Implement Grishnakh, Brash Instigator --- .../cards/g/GrishnakhBrashInstigator.java | 109 ++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 110 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GrishnakhBrashInstigator.java diff --git a/Mage.Sets/src/mage/cards/g/GrishnakhBrashInstigator.java b/Mage.Sets/src/mage/cards/g/GrishnakhBrashInstigator.java new file mode 100644 index 00000000000..4ca48e33bb0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GrishnakhBrashInstigator.java @@ -0,0 +1,109 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.abilities.effects.keyword.AmassEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterOpponentsCreaturePermanent; +import mage.filter.predicate.Predicate; +import mage.filter.predicate.Predicates; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GrishnakhBrashInstigator extends CardImpl { + + public GrishnakhBrashInstigator(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.GOBLIN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // When Grishnakh, Brash Instigator enters the battlefield, amass Orcs 2. When you do, until end of turn, gain control of target nonlegendary creature an opponent controls with power less than or equal to the amassed Army's power. Untap that creature. It gains haste until end of turn. + this.addAbility(new EntersBattlefieldTriggeredAbility(new GrishnakhBrashInstigatorEffect())); + } + + private GrishnakhBrashInstigator(final GrishnakhBrashInstigator card) { + super(card); + } + + @Override + public GrishnakhBrashInstigator copy() { + return new GrishnakhBrashInstigator(this); + } +} + +class GrishnakhBrashInstigatorEffect extends OneShotEffect { + + private static class GrishnakhBrashInstigatorPredicate implements Predicate { + + private final Permanent permanent; + + GrishnakhBrashInstigatorPredicate(Permanent permanent) { + this.permanent = permanent; + } + + @Override + public boolean apply(Permanent input, Game game) { + return input.getPower().getValue() <= permanent.getPower().getValue(); + } + } + + GrishnakhBrashInstigatorEffect() { + super(Outcome.Benefit); + staticText = "amass Orcs 2. When you do, until end of turn, gain control of target nonlegendary creature " + + "an opponent controls with power less than or equal to the amassed Army's power. " + + "Untap that creature. It gains haste until end of turn"; + } + + private GrishnakhBrashInstigatorEffect(final GrishnakhBrashInstigatorEffect effect) { + super(effect); + } + + @Override + public GrishnakhBrashInstigatorEffect copy() { + return new GrishnakhBrashInstigatorEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = AmassEffect.doAmass(2, SubType.ORC, game, source); + if (permanent == null) { + return false; + } + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( + new GainControlTargetEffect(Duration.EndOfTurn) + .setText("until end of turn, gain control of target nonlegendary creature " + + "an opponent controls with power less than or equal to the amassed Army's power"), + false + ); + ability.addEffect(new UntapTargetEffect("Untap that creature")); + ability.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance()) + .setText("It gains haste until end of turn")); + FilterPermanent filter = new FilterOpponentsCreaturePermanent( + "nonlegendary creature an opponent controls with power " + + "less than or equal to the amassed Army's power" + ); + filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); + filter.add(new GrishnakhBrashInstigatorPredicate(permanent)); + ability.addTarget(new TargetPermanent(filter));game.fireReflexiveTriggeredAbility(ability,source);return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index 451f6dbee88..1bd4fbecfc4 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -50,6 +50,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Gollum's Bite", 85, Rarity.UNCOMMON, mage.cards.g.GollumsBite.class)); cards.add(new SetCardInfo("Gollum, Patient Plotter", 84, Rarity.UNCOMMON, mage.cards.g.GollumPatientPlotter.class)); cards.add(new SetCardInfo("Gothmog, Morgul Lieutenant", 87, Rarity.UNCOMMON, mage.cards.g.GothmogMorgulLieutenant.class)); + cards.add(new SetCardInfo("Grishnakh, Brash Instigator", 134, Rarity.UNCOMMON, mage.cards.g.GrishnakhBrashInstigator.class)); cards.add(new SetCardInfo("Grond, the Gatebreaker", 89, Rarity.UNCOMMON, mage.cards.g.GrondTheGatebreaker.class)); cards.add(new SetCardInfo("Hew the Entwood", 136, Rarity.MYTHIC, mage.cards.h.HewTheEntwood.class)); cards.add(new SetCardInfo("Island", 264, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));