[SNC] Implemented Vivien on the Hunt

This commit is contained in:
Evan Kranzler 2022-04-08 09:28:13 -04:00
parent 7a8feb5017
commit 5f3cb23476
3 changed files with 167 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));

View file

@ -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);
}
}