[MH2] Implemented Verdant Command

This commit is contained in:
Evan Kranzler 2021-06-01 09:15:27 -04:00
parent 3ff3146107
commit e1d462e180
2 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,85 @@
package mage.cards.v;
import mage.abilities.LoyaltyAbility;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.CreateTokenTargetEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.GainLifeTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterStackObject;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SquirrelToken;
import mage.game.stack.StackObject;
import mage.target.TargetPlayer;
import mage.target.TargetStackObject;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class VerdantCommand extends CardImpl {
private static final FilterStackObject filter = new FilterStackObject("loyalty ability of a planeswalker");
static {
filter.add(VerdantCommandPredicate.instance);
}
public VerdantCommand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}");
// Choose two
this.getSpellAbility().getModes().setMinModes(2);
this.getSpellAbility().getModes().setMaxModes(2);
// Target player creates two tapped 1/1 green Squirrel creature tokens.
this.getSpellAbility().addEffect(new CreateTokenTargetEffect(
new SquirrelToken(), StaticValue.get(2), true, false
));
// Counter target loyalty ability of a planeswalker.
Mode mode = new Mode(new CounterTargetEffect());
mode.addTarget(new TargetStackObject(filter));
this.getSpellAbility().addMode(mode);
// Exile target card from a graveyard.
mode = new Mode(new ExileTargetEffect());
mode.addTarget(new TargetCardInGraveyard());
this.getSpellAbility().addMode(mode);
// Target player gains 3 life.
mode = new Mode(new GainLifeTargetEffect(3));
mode.addTarget(new TargetPlayer());
this.getSpellAbility().addMode(mode);
}
private VerdantCommand(final VerdantCommand card) {
super(card);
}
@Override
public VerdantCommand copy() {
return new VerdantCommand(this);
}
}
enum VerdantCommandPredicate implements Predicate<StackObject> {
instance;
@Override
public boolean apply(StackObject input, Game game) {
if (!(input instanceof LoyaltyAbility)) {
return false;
}
Permanent permanent = ((LoyaltyAbility) input).getSourcePermanentOrLKI(game);
return permanent != null && permanent.isPlaneswalker();
}
}

View file

@ -202,6 +202,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Vectis Gloves", 241, Rarity.UNCOMMON, mage.cards.v.VectisGloves.class));
cards.add(new SetCardInfo("Vedalken Infiltrator", 73, Rarity.UNCOMMON, mage.cards.v.VedalkenInfiltrator.class));
cards.add(new SetCardInfo("Verdant Catacombs", 260, Rarity.RARE, mage.cards.v.VerdantCatacombs.class));
cards.add(new SetCardInfo("Verdant Command", 182, Rarity.RARE, mage.cards.v.VerdantCommand.class));
cards.add(new SetCardInfo("Vindicate", 294, Rarity.RARE, mage.cards.v.Vindicate.class));
cards.add(new SetCardInfo("Void Mirror", 242, Rarity.RARE, mage.cards.v.VoidMirror.class));
cards.add(new SetCardInfo("Wonder", 271, Rarity.RARE, mage.cards.w.Wonder.class));