From 468909f28761ec26b28cc8e6adad1ff397493a05 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 25 May 2019 10:50:55 -0400 Subject: [PATCH] Implemented Goatnap --- Mage.Sets/src/mage/cards/g/Goatnap.java | 75 +++++++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons.java | 1 + 2 files changed, 76 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/Goatnap.java diff --git a/Mage.Sets/src/mage/cards/g/Goatnap.java b/Mage.Sets/src/mage/cards/g/Goatnap.java new file mode 100644 index 00000000000..72ae6a27d4a --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/Goatnap.java @@ -0,0 +1,75 @@ +package mage.cards.g; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Goatnap extends CardImpl { + + public Goatnap(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}"); + + // Gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. If that creature is a Goat, it also gets +3/+0 until end of turn. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new UntapTargetEffect().setText("Untap that creature")); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect( + HasteAbility.getInstance(), Duration.EndOfTurn + ).setText("It gains haste until end of turn.")); + this.getSpellAbility().addEffect(new GoatnapEffect()); + } + + private Goatnap(final Goatnap card) { + super(card); + } + + @Override + public Goatnap copy() { + return new Goatnap(this); + } +} + +class GoatnapEffect extends OneShotEffect { + + GoatnapEffect() { + super(Outcome.Benefit); + staticText = "If that creature is a Goat, it also gets +3/+0 until end of turn."; + } + + private GoatnapEffect(final GoatnapEffect effect) { + super(effect); + } + + @Override + public GoatnapEffect copy() { + return new GoatnapEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null || !permanent.hasSubtype(SubType.GOAT, game)) { + return false; + } + game.addEffect(new BoostTargetEffect(3, 0, Duration.EndOfTurn), source); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ModernHorizons.java b/Mage.Sets/src/mage/sets/ModernHorizons.java index 04e60884e1a..0864e1c5933 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons.java @@ -61,6 +61,7 @@ public final class ModernHorizons extends ExpansionSet { cards.add(new SetCardInfo("Generous Gift", 11, Rarity.UNCOMMON, mage.cards.g.GenerousGift.class)); cards.add(new SetCardInfo("Genesis", 166, Rarity.RARE, mage.cards.g.Genesis.class)); cards.add(new SetCardInfo("Glacial Revelation", 167, Rarity.UNCOMMON, mage.cards.g.GlacialRevelation.class)); + cards.add(new SetCardInfo("Goatnap", 126, Rarity.COMMON, mage.cards.g.Goatnap.class)); cards.add(new SetCardInfo("Goblin Engineer", 128, Rarity.RARE, mage.cards.g.GoblinEngineer.class)); cards.add(new SetCardInfo("Goblin Matron", 129, Rarity.UNCOMMON, mage.cards.g.GoblinMatron.class)); cards.add(new SetCardInfo("Goblin War Party", 131, Rarity.COMMON, mage.cards.g.GoblinWarParty.class));