From 24be54606a3beaf3420bb5bce7c2dfc194762687 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 10 Sep 2018 21:54:17 -0400 Subject: [PATCH] Implemented Assassin's Trophy --- .../src/mage/cards/a/AssassinsTrophy.java | 91 +++++++++++++++++++ Mage.Sets/src/mage/sets/GuildsOfRavnica.java | 1 + 2 files changed, 92 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AssassinsTrophy.java diff --git a/Mage.Sets/src/mage/cards/a/AssassinsTrophy.java b/Mage.Sets/src/mage/cards/a/AssassinsTrophy.java new file mode 100644 index 0000000000..0d3015285a --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AssassinsTrophy.java @@ -0,0 +1,91 @@ +package mage.cards.a; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author TheElk801 + */ +public final class AssassinsTrophy extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("permanent an opponent controls"); + + static { + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + } + + public AssassinsTrophy(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}{G}"); + + // Destroy target permanent an opponent controls. Its controller may search their library for a basic land card, put it onto the battlefield, then shuffle their library. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addEffect(new AssassinsTrophyEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + } + + public AssassinsTrophy(final AssassinsTrophy card) { + super(card); + } + + @Override + public AssassinsTrophy copy() { + return new AssassinsTrophy(this); + } +} + +class AssassinsTrophyEffect extends OneShotEffect { + + public AssassinsTrophyEffect() { + super(Outcome.PutLandInPlay); + this.staticText = "Its controller may search their library " + + "for a basic land card, put it onto the battlefield, " + + "then shuffle their library"; + } + + public AssassinsTrophyEffect(final AssassinsTrophyEffect effect) { + super(effect); + } + + @Override + public AssassinsTrophyEffect copy() { + return new AssassinsTrophyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanentOrLKIBattlefield(source.getFirstTarget()); + if (permanent != null) { + Player controller = game.getPlayer(permanent.getControllerId()); + if (controller.chooseUse(Outcome.PutLandInPlay, "Do you wish to search for a basic land, put it onto the battlefield and then shuffle your library?", source, game)) { + TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND); + if (controller.searchLibrary(target, game)) { + Card card = controller.getLibrary().getCard(target.getFirstTarget(), game); + if (card != null) { + controller.moveCards(card, Zone.BATTLEFIELD, source, game); + } + } + controller.shuffleLibrary(source, game); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java index 7c597ed9d3..0fdd130e7d 100644 --- a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java +++ b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java @@ -23,6 +23,7 @@ public final class GuildsOfRavnica extends ExpansionSet { this.ratioBoosterMythic = 8; cards.add(new SetCardInfo("Arboretum Elemental", 122, Rarity.UNCOMMON, mage.cards.a.ArboretumElemental.class)); + cards.add(new SetCardInfo("Assassin's Trophy", 152, Rarity.RARE, mage.cards.a.AssassinsTrophy.class)); cards.add(new SetCardInfo("Attendant of Vraska", 271, Rarity.UNCOMMON, mage.cards.a.AttendantOfVraska.class)); cards.add(new SetCardInfo("Barging Sergeant", 92, Rarity.COMMON, mage.cards.b.BargingSergeant.class)); cards.add(new SetCardInfo("Blade Instructor", 1, Rarity.COMMON, mage.cards.b.BladeInstructor.class));