From 5f3cb23476ef39d0996d98328a74c079237bd6d4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 8 Apr 2022 09:28:13 -0400 Subject: [PATCH] [SNC] Implemented Vivien on the Hunt --- .../src/mage/cards/v/VivienOnTheHunt.java | 133 ++++++++++++++++++ .../src/mage/sets/StreetsOfNewCapenna.java | 1 + .../permanent/token/RhinoWarriorToken.java | 33 +++++ 3 files changed, 167 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/v/VivienOnTheHunt.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/RhinoWarriorToken.java diff --git a/Mage.Sets/src/mage/cards/v/VivienOnTheHunt.java b/Mage.Sets/src/mage/cards/v/VivienOnTheHunt.java new file mode 100644 index 0000000000..559f9fb13c --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/VivienOnTheHunt.java @@ -0,0 +1,133 @@ +package mage.cards.v; + +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.*; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.ManaValuePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.RhinoWarriorToken; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.TargetPermanent; +import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class VivienOnTheHunt extends CardImpl { + + public VivienOnTheHunt(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{G}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.VIVIEN); + this.setStartingLoyalty(4); + + // +2: You may sacrifice a creature. If you do, search your library for a creature card with mana value equal to 1 plus the sacrificed creature's mana value, put it onto the battlefield, then shuffle. + this.addAbility(new LoyaltyAbility(new VivienOnTheHuntSacrificeEffect(), 2)); + + // +1: Mill five cards, then put any number of creature cards milled this way into your hand. + this.addAbility(new LoyaltyAbility(new VivienOnTheHuntMillEffect(), 1)); + + // −1: Create a 4/4 green Rhino Warrior creature token. + this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new RhinoWarriorToken()), -1)); + } + + private VivienOnTheHunt(final VivienOnTheHunt card) { + super(card); + } + + @Override + public VivienOnTheHunt copy() { + return new VivienOnTheHunt(this); + } +} + +class VivienOnTheHuntSacrificeEffect extends OneShotEffect { + + VivienOnTheHuntSacrificeEffect() { + super(Outcome.Benefit); + staticText = "you may sacrifice a creature. If you do, search your library for a creature card with mana " + + "value equal to 1 plus the sacrificed creature's mana value, put it onto the battlefield, then shuffle"; + } + + private VivienOnTheHuntSacrificeEffect(final VivienOnTheHuntSacrificeEffect effect) { + super(effect); + } + + @Override + public VivienOnTheHuntSacrificeEffect copy() { + return new VivienOnTheHuntSacrificeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetPermanent target = new TargetPermanent( + 0, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true + ); + player.choose(Outcome.Sacrifice, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent == null || !permanent.sacrifice(source, game)) { + return false; + } + int mv = permanent.getManaValue() + 1; + FilterCard filter = new FilterCreatureCard("creature card with mana value " + mv); + filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, mv)); + TargetCardInLibrary targetCardInLibrary = new TargetCardInLibrary(filter); + player.searchLibrary(targetCardInLibrary, source, game); + Card card = player.getLibrary().getCard(targetCardInLibrary.getFirstTarget(), game); + if (card != null) { + player.moveCards(card, Zone.BATTLEFIELD, source, game); + } + player.shuffleLibrary(source, game); + return true; + } +} + +class VivienOnTheHuntMillEffect extends OneShotEffect { + + VivienOnTheHuntMillEffect() { + super(Outcome.Benefit); + staticText = "mill five cards, then put any number of creature cards milled this way into your hand"; + } + + private VivienOnTheHuntMillEffect(final VivienOnTheHuntMillEffect effect) { + super(effect); + } + + @Override + public VivienOnTheHuntMillEffect copy() { + return new VivienOnTheHuntMillEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = player.millCards(5, source, game); + if (cards.count(StaticFilters.FILTER_CARD_CREATURE, game) < 1) { + return true; + } + TargetCard target = new TargetCard( + 0, Integer.MAX_VALUE, Zone.ALL, StaticFilters.FILTER_CARD_CREATURE + ); + player.choose(outcome, cards, target, game); + player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index ea5310389d..4303bdc79c 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -62,6 +62,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Strangle", 125, Rarity.COMMON, mage.cards.s.Strangle.class)); cards.add(new SetCardInfo("Swamp", 266, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Tramway Station", 258, Rarity.COMMON, mage.cards.t.TramwayStation.class)); + cards.add(new SetCardInfo("Vivien on the Hunt", 347, Rarity.MYTHIC, mage.cards.v.VivienOnTheHunt.class)); cards.add(new SetCardInfo("Waterfront District", 259, Rarity.COMMON, mage.cards.w.WaterfrontDistrict.class)); cards.add(new SetCardInfo("Xander's Lounge", 260, Rarity.RARE, mage.cards.x.XandersLounge.class)); cards.add(new SetCardInfo("Ziatora's Proving Ground", 261, Rarity.RARE, mage.cards.z.ZiatorasProvingGround.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/RhinoWarriorToken.java b/Mage/src/main/java/mage/game/permanent/token/RhinoWarriorToken.java new file mode 100644 index 0000000000..a051e1dcfe --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/RhinoWarriorToken.java @@ -0,0 +1,33 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +import java.util.Arrays; + +/** + * @author TheElk801 + */ +public final class RhinoWarriorToken extends TokenImpl { + + public RhinoWarriorToken() { + super("Rhino Warrior Token", "4/4 green Rhino Warrior creature token"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + subtype.add(SubType.RHINO); + subtype.add(SubType.WARRIOR); + power = new MageInt(4); + toughness = new MageInt(4); + + availableImageSetCodes = Arrays.asList("SNC"); + } + + public RhinoWarriorToken(final RhinoWarriorToken token) { + super(token); + } + + public RhinoWarriorToken copy() { + return new RhinoWarriorToken(this); + } +}