This commit is contained in:
jeffwadsworth 2020-08-04 16:19:42 -05:00
parent b17150188f
commit d945f95324

View file

@ -27,7 +27,6 @@ import mage.game.permanent.token.Token;
import mage.game.stack.Spell; import mage.game.stack.Spell;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
@ -54,10 +53,12 @@ public final class VivienMonstersAdvocate extends CardImpl {
// You may cast creature spells from the top of your library. // You may cast creature spells from the top of your library.
this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect(filter))); this.addAbility(new SimpleStaticAbility(new PlayTheTopCardEffect(filter)));
// +1: Create a 3/3 green Beast creature token. Put your choice of a vigilance counter, a reach counter, or a trample counter on it. // +1: Create a 3/3 green Beast creature token. Put your choice of a vigilance
// counter, a reach counter, or a trample counter on it.
this.addAbility(new LoyaltyAbility(new VivienMonstersAdvocateTokenEffect(), 1)); this.addAbility(new LoyaltyAbility(new VivienMonstersAdvocateTokenEffect(), 1));
// 2: When you cast your next creature spell this turn, search your library for a creature card with lesser converted mana cost, put it onto the battlefield, then shuffle your library. // 2: When you cast your next creature spell this turn, search your library for a
// creature card with lesser converted mana cost, put it onto the battlefield, then shuffle your library.
this.addAbility(new LoyaltyAbility( this.addAbility(new LoyaltyAbility(
new CreateDelayedTriggeredAbilityEffect(new VivienMonstersAdvocateTriggeredAbility()), -2 new CreateDelayedTriggeredAbilityEffect(new VivienMonstersAdvocateTriggeredAbility()), -2
)); ));
@ -81,8 +82,8 @@ class VivienMonstersAdvocateTokenEffect extends OneShotEffect {
VivienMonstersAdvocateTokenEffect() { VivienMonstersAdvocateTokenEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "Create a 3/3 green Beast creature token. Put your choice of a vigilance counter, " + staticText = "Create a 3/3 green Beast creature token. Put your choice of a vigilance counter, "
"a reach counter, or a trample counter on it."; + "a reach counter, or a trample counter on it.";
} }
private VivienMonstersAdvocateTokenEffect(final VivienMonstersAdvocateTokenEffect effect) { private VivienMonstersAdvocateTokenEffect(final VivienMonstersAdvocateTokenEffect effect) {
@ -111,7 +112,8 @@ class VivienMonstersAdvocateTokenEffect extends OneShotEffect {
player.choose(outcome, choice, game); player.choose(outcome, choice, game);
String chosen = choice.getChoice(); String chosen = choice.getChoice();
if (chosen != null) { if (chosen != null) {
permanent.addCounters(CounterType.findByName(chosen.toLowerCase(Locale.ENGLISH)).createInstance(), source, game); permanent.addCounters(CounterType.findByName(chosen.toLowerCase(
Locale.ENGLISH)).createInstance(), source, game);
} }
} }
return true; return true;
@ -136,15 +138,16 @@ class VivienMonstersAdvocateTriggeredAbility extends DelayedTriggeredAbility {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = game.getSpell(event.getTargetId()); Spell spell = game.getSpell(event.getTargetId());
if (spell == null) { if (spell != null
return false; && spell.isCreature()) {
int cmc = spell.getConvertedManaCost();
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost less than " + cmc);
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, cmc));
this.getEffects().clear();
this.getEffects().add(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)));
return true;
} }
int cmc = spell.getConvertedManaCost(); return false;
FilterCard filter = new FilterCreatureCard("creature card with converted mana cost less than " + cmc);
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, cmc));
this.getEffects().clear();
this.getEffects().add(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter)));
return true;
} }
@Override @Override
@ -154,8 +157,8 @@ class VivienMonstersAdvocateTriggeredAbility extends DelayedTriggeredAbility {
@Override @Override
public String getRule() { public String getRule() {
return "When you cast your next creature spell this turn, " + return "When you cast your next creature spell this turn, "
"search your library for a creature card with lesser converted mana cost, " + + "search your library for a creature card with lesser converted mana cost, "
"put it onto the battlefield, then shuffle your library."; + "put it onto the battlefield, then shuffle your library.";
} }
} }