Implemented Bartered Cow

This commit is contained in:
Evan Kranzler 2019-09-21 16:30:06 -04:00
parent e9f04114d8
commit 112cc44666
2 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,66 @@
package mage.cards.b;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DiscardCardControllerTriggeredAbility;
import mage.abilities.meta.OrTriggeredAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.token.FoodToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BarteredCow extends CardImpl {
private static final FilterCard filter = new FilterCard();
static {
filter.add(BarteredCowPredicate.instance);
}
public BarteredCow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.subtype.add(SubType.OX);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// When Bartered Cow dies or when you discard it, create a Food token.
this.addAbility(new OrTriggeredAbility(
Zone.ALL, new CreateTokenEffect(new FoodToken()), false,
"When {this} dies or when you discard it, ", new DiesTriggeredAbility((Effect) null),
new DiscardCardControllerTriggeredAbility(null, false, filter)
));
}
private BarteredCow(final BarteredCow card) {
super(card);
}
@Override
public BarteredCow copy() {
return new BarteredCow(this);
}
}
enum BarteredCowPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageObject>> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
return input.getObject().getId().equals(input.getSourceId());
}
}

View file

@ -41,6 +41,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Banish into Fable", 325, Rarity.RARE, mage.cards.b.BanishIntoFable.class));
cards.add(new SetCardInfo("Barge In", 112, Rarity.COMMON, mage.cards.b.BargeIn.class));
cards.add(new SetCardInfo("Barrow Witches", 77, Rarity.COMMON, mage.cards.b.BarrowWitches.class));
cards.add(new SetCardInfo("Bartered Cow", 6, Rarity.COMMON, mage.cards.b.BarteredCow.class));
cards.add(new SetCardInfo("Beanstalk Giant", 149, Rarity.UNCOMMON, mage.cards.b.BeanstalkGiant.class));
cards.add(new SetCardInfo("Belle of the Brawl", 78, Rarity.UNCOMMON, mage.cards.b.BelleOfTheBrawl.class));
cards.add(new SetCardInfo("Beloved Princess", 7, Rarity.COMMON, mage.cards.b.BelovedPrincess.class));