[CMR] Implemented Miara, Thorn of the Glade

This commit is contained in:
Evan Kranzler 2020-11-07 13:30:30 -05:00
parent f7ea0c0ece
commit c7c76c262a
3 changed files with 75 additions and 65 deletions

View file

@ -4,8 +4,7 @@ import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.CompositeCost;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
@ -20,7 +19,6 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledPermanent;
@ -32,9 +30,13 @@ import java.util.UUID;
public final class MagusOfTheOrder extends CardImpl {
private static final FilterCard filter = new FilterCreatureCard("green creature card");
private static final FilterControlledPermanent filter2
= new FilterControlledPermanent("another green creature");
static {
filter.add(new ColorPredicate(ObjectColor.GREEN));
filter2.add(AnotherPredicate.instance);
filter2.add(new ColorPredicate(ObjectColor.GREEN));
}
public MagusOfTheOrder(UUID ownerId, CardSetInfo setInfo) {
@ -50,7 +52,10 @@ public final class MagusOfTheOrder extends CardImpl {
new TargetCardInLibrary(1, filter), false, true
), new ManaCostsImpl("{G}"));
ability.addCost(new TapSourceCost());
ability.addCost(new MagusOfTheOrderCost());
ability.addCost(new CompositeCost(
new SacrificeSourceCost(), new SacrificeTargetCost(new TargetControlledPermanent(filter2)),
"sacrifice Magus of the Order and another green creature"
));
this.addAbility(ability);
}
@ -63,64 +68,3 @@ public final class MagusOfTheOrder extends CardImpl {
return new MagusOfTheOrder(this);
}
}
class MagusOfTheOrderCost extends CostImpl {
private static final FilterControlledPermanent filter
= new FilterControlledPermanent("another green creature");
static {
filter.add(AnotherPredicate.instance);
filter.add(new ColorPredicate(ObjectColor.GREEN));
}
private final Cost cost1;
private final Cost cost2;
MagusOfTheOrderCost() {
super();
this.cost1 = new SacrificeSourceCost();
this.cost2 = new SacrificeTargetCost(new TargetControlledPermanent(filter));
this.text = "sacrifice {this} and another green creature";
}
private MagusOfTheOrderCost(final MagusOfTheOrderCost cost) {
super(cost);
this.cost1 = cost.cost1.copy();
this.cost2 = cost.cost2.copy();
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
return cost1.canPay(ability, sourceId, controllerId, game)
&& cost2.canPay(ability, sourceId, controllerId, game);
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
return cost1.pay(ability, game, sourceId, controllerId, noMana, costToPay)
&& cost2.pay(ability, game, sourceId, controllerId, noMana, costToPay);
}
@Override
public boolean isPaid() {
return cost1.isPaid() && cost2.isPaid();
}
@Override
public void clearPaid() {
cost1.clearPaid();
cost2.clearPaid();
}
@Override
public void setPaid() {
cost1.setPaid();
cost2.setPaid();
}
@Override
public MagusOfTheOrderCost copy() {
return new MagusOfTheOrderCost(this);
}
}

View file

@ -0,0 +1,65 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
import mage.abilities.costs.CompositeCost;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.PartnerAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MiaraThornOfTheGlade extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.ELF, "Elf you control");
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public MiaraThornOfTheGlade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.SCOUT);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// Whenever Miara, Thorn of the Glade or another Elf you control dies, you may pay {1} and 1 life. If you do, draw a card.
this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(
new DoIfCostPaid(
new DrawCardSourceControllerEffect(1),
new CompositeCost(
new GenericManaCost(1),
new PayLifeCost(1),
"{1} and 1 life"
)
), false, filter
));
// Partner
this.addAbility(PartnerAbility.getInstance());
}
private MiaraThornOfTheGlade(final MiaraThornOfTheGlade card) {
super(card);
}
@Override
public MiaraThornOfTheGlade copy() {
return new MiaraThornOfTheGlade(this);
}
}

View file

@ -287,6 +287,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Merchant Raiders", 81, Rarity.UNCOMMON, mage.cards.m.MerchantRaiders.class));
cards.add(new SetCardInfo("Meteor Golem", 325, Rarity.UNCOMMON, mage.cards.m.MeteorGolem.class));
cards.add(new SetCardInfo("Meteoric Mace", 192, Rarity.UNCOMMON, mage.cards.m.MeteoricMace.class));
cards.add(new SetCardInfo("Miara, Thorn of the Glade", 133, Rarity.UNCOMMON, mage.cards.m.MiaraThornOfTheGlade.class));
cards.add(new SetCardInfo("Mindless Automaton", 326, Rarity.UNCOMMON, mage.cards.m.MindlessAutomaton.class));
cards.add(new SetCardInfo("Mnemonic Deluge", 82, Rarity.MYTHIC, mage.cards.m.MnemonicDeluge.class));
cards.add(new SetCardInfo("Molder Beast", 243, Rarity.COMMON, mage.cards.m.MolderBeast.class));