Implemented Prime Speaker Vannifar

This commit is contained in:
Evan Kranzler 2019-01-03 21:22:42 -05:00
parent a7b0f05890
commit 5c0084699b
3 changed files with 134 additions and 20 deletions

View file

@ -1,7 +1,6 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.Cost;
@ -17,7 +16,7 @@ import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
@ -26,6 +25,8 @@ import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author Loki
*/
@ -36,9 +37,13 @@ public final class BirthingPod extends CardImpl {
// {1}{G/P}, {tap}, Sacrifice a creature: Search your library for a creature card with converted mana cost equal to 1 plus the sacrificed creature's converted mana cost,
// put that card onto the battlefield, then shuffle your library. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new BirthingPodEffect(), new ManaCostsImpl("{1}{G/P}"));
Ability ability = new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD, new BirthingPodEffect(), new ManaCostsImpl("{1}{G/P}")
);
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(
StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT
)));
this.addAbility(ability);
}
@ -56,11 +61,12 @@ class BirthingPodEffect extends OneShotEffect {
BirthingPodEffect() {
super(Outcome.Benefit);
staticText = "Search your library for a creature card with converted mana cost equal to 1 plus the sacrificed creature's converted mana cost, put that card "
+ "onto the battlefield, then shuffle your library";
staticText = "Search your library for a creature card with converted mana cost equal to 1 " +
"plus the sacrificed creature's converted mana cost, put that card " +
"onto the battlefield, then shuffle your library";
}
BirthingPodEffect(final BirthingPodEffect effect) {
private BirthingPodEffect(final BirthingPodEffect effect) {
super(effect);
}
@ -77,20 +83,20 @@ class BirthingPodEffect extends OneShotEffect {
}
}
Player controller = game.getPlayer(source.getControllerId());
if (sacrificedPermanent != null && controller != null) {
int newConvertedCost = sacrificedPermanent.getConvertedManaCost() + 1;
FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, newConvertedCost));
filter.add(new CardTypePredicate(CardType.CREATURE));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
controller.shuffleLibrary(source, game);
return true;
if (sacrificedPermanent == null || controller == null) {
return false;
}
return false;
int newConvertedCost = sacrificedPermanent.getConvertedManaCost() + 1;
FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, newConvertedCost));
filter.add(new CardTypePredicate(CardType.CREATURE));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
controller.shuffleLibrary(source, game);
return true;
}
@Override

View file

@ -0,0 +1,107 @@
package mage.cards.p;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801 and Loki
*/
public final class PrimeSpeakerVannifar extends CardImpl {
public PrimeSpeakerVannifar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.OOZE);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// {T}, Sacrifice another creature: Search your library for a creature card with converted mana cost equal to 1 plus the sacrificed creature's converted mana cost, put that card onto the battlefield, then shuffle your library. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD, new PrimeSpeakerVannifarEffect(), new TapSourceCost()
);
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(
StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE
)));
this.addAbility(ability);
}
private PrimeSpeakerVannifar(final PrimeSpeakerVannifar card) {
super(card);
}
@Override
public PrimeSpeakerVannifar copy() {
return new PrimeSpeakerVannifar(this);
}
}
class PrimeSpeakerVannifarEffect extends OneShotEffect {
PrimeSpeakerVannifarEffect() {
super(Outcome.Benefit);
staticText = "Search your library for a creature card with converted mana cost equal to 1 " +
"plus the sacrificed creature's converted mana cost, put that card " +
"onto the battlefield, then shuffle your library";
}
private PrimeSpeakerVannifarEffect(final PrimeSpeakerVannifarEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sacrificedPermanent = null;
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
if (!sacrificeCost.getPermanents().isEmpty()) {
sacrificedPermanent = sacrificeCost.getPermanents().get(0);
}
break;
}
}
Player controller = game.getPlayer(source.getControllerId());
if (sacrificedPermanent == null || controller == null) {
return false;
}
int newConvertedCost = sacrificedPermanent.getConvertedManaCost() + 1;
FilterCard filter = new FilterCard("creature card with converted mana cost " + newConvertedCost);
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, newConvertedCost));
filter.add(new CardTypePredicate(CardType.CREATURE));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
controller.shuffleLibrary(source, game);
return true;
}
@Override
public PrimeSpeakerVannifarEffect copy() {
return new PrimeSpeakerVannifarEffect(this);
}
}

View file

@ -72,6 +72,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Pestilent Spirit", 81, Rarity.RARE, mage.cards.p.PestilentSpirit.class));
cards.add(new SetCardInfo("Pitiless Pontiff", 194, Rarity.UNCOMMON, mage.cards.p.PitilessPontiff.class));
cards.add(new SetCardInfo("Precognitive Perception", 45, Rarity.RARE, mage.cards.p.PrecognitivePerception.class));
cards.add(new SetCardInfo("Prime Speaker Vannifar", 195, Rarity.MYTHIC, mage.cards.p.PrimeSpeakerVannifar.class));
cards.add(new SetCardInfo("Rafter Demon", 196, Rarity.COMMON, mage.cards.r.RafterDemon.class));
cards.add(new SetCardInfo("Rakdos Firewheeler", 197, Rarity.UNCOMMON, mage.cards.r.RakdosFirewheeler.class));
cards.add(new SetCardInfo("Rakdos Guildgate", 255, Rarity.COMMON, mage.cards.r.RakdosGuildgate.class, NON_FULL_USE_VARIOUS));