Implemented Vivien's Arkbow

This commit is contained in:
Evan Kranzler 2019-04-01 20:59:11 -04:00
parent 47605b3792
commit 864a40c5a8
2 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,90 @@
package mage.cards.v;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.*;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInHand;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ViviensArkbow extends CardImpl {
public ViviensArkbow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{G}");
this.addSuperType(SuperType.LEGENDARY);
// {X}, {T}, Discard a card: Look at the top X cards of your library. You may put a creature card with converted mana cost X or less from among them onto the battlefield. Put the rest on the bottom of your library in a random order.
Ability ability = new SimpleActivatedAbility(
new ViviensArkbowEffect(), new ManaCostsImpl("{X}")
);
ability.addCost(new TapSourceCost());
ability.addCost(new DiscardCardCost());
this.addAbility(ability);
}
private ViviensArkbow(final ViviensArkbow card) {
super(card);
}
@Override
public ViviensArkbow copy() {
return new ViviensArkbow(this);
}
}
class ViviensArkbowEffect extends OneShotEffect {
ViviensArkbowEffect() {
super(Outcome.Benefit);
staticText = "Look at the top X cards of your library. " +
"You may put a creature card with converted mana cost X or less " +
"from among them onto the battlefield. Put the rest on the bottom of your library in a random order.";
}
private ViviensArkbowEffect(final ViviensArkbowEffect effect) {
super(effect);
}
@Override
public ViviensArkbowEffect copy() {
return new ViviensArkbowEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int xValue = source.getManaCostsToPay().getX();
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, xValue));
player.lookAtCards(source, null, cards, game);
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less");
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, xValue + 1));
TargetCard target = new TargetCardInHand(0, 1, filter);
if (player.choose(outcome, cards, target, game)) {
Card card = game.getCard(target.getFirstTarget());
if (player.moveCards(card, Zone.BATTLEFIELD, source, game)) {
cards.remove(card);
}
}
return player.putCardsOnBottomOfLibrary(cards, game, source, false);
}
}

View file

@ -84,6 +84,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Tibalt's Rager", 147, Rarity.UNCOMMON, mage.cards.t.TibaltsRager.class));
cards.add(new SetCardInfo("Tibalt, Rakish Instigator", 146, Rarity.UNCOMMON, mage.cards.t.TibaltRakishInstigator.class));
cards.add(new SetCardInfo("Time Wipe", 223, Rarity.RARE, mage.cards.t.TimeWipe.class));
cards.add(new SetCardInfo("Vivien's Arkbow", 181, Rarity.RARE, mage.cards.v.ViviensArkbow.class));
cards.add(new SetCardInfo("Vivien's Grizzly", 182, Rarity.COMMON, mage.cards.v.ViviensGrizzly.class));
cards.add(new SetCardInfo("Vraska's Finisher", 112, Rarity.COMMON, mage.cards.v.VraskasFinisher.class));
cards.add(new SetCardInfo("Vraska, Swarm's Eminence", 236, Rarity.UNCOMMON, mage.cards.v.VraskaSwarmsEminence.class));