Implemented Bone Miser

This commit is contained in:
Evan Kranzler 2019-08-09 21:14:05 -04:00
parent 247973da76
commit c75a689efd
5 changed files with 128 additions and 15 deletions

View file

@ -0,0 +1,65 @@
package mage.cards.b;
import mage.MageInt;
import mage.Mana;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DiscardCardControllerTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.permanent.token.ZombieToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BoneMiser extends CardImpl {
private static final FilterCard filter = new FilterNonlandCard("a noncreature, nonland card");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
public BoneMiser(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
this.subtype.add(SubType.ZOMBIE);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Whenever you discard a creature card, create a 2/2 black Zombie creature token.
this.addAbility(new DiscardCardControllerTriggeredAbility(
new CreateTokenEffect(new ZombieToken()), false, StaticFilters.FILTER_CARD_CREATURE_A
));
// Whenever you discard a land card, add {B}{B}.
this.addAbility(new DiscardCardControllerTriggeredAbility(
new BasicManaEffect(Mana.BlackMana(2)), false, StaticFilters.FILTER_CARD_LAND_A
));
// Whenever you discard a noncreature, nonland card, draw a card.
this.addAbility(new DiscardCardControllerTriggeredAbility(
new DrawCardSourceControllerEffect(1), false, filter
));
}
private BoneMiser(final BoneMiser card) {
super(card);
}
@Override
public BoneMiser copy() {
return new BoneMiser(this);
}
}

View file

@ -4,7 +4,7 @@ package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DiscardsACardPlayerTriggeredAbility;
import mage.abilities.effects.common.DiscardCardPlayerTriggeredAbility;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.MayTapOrUntapTargetEffect;
import mage.cards.CardImpl;
@ -23,7 +23,7 @@ public final class TelekineticBonds extends CardImpl {
// Whenever a player discards a card, you may pay {1}{U}. If you do, you may tap or untap target permanent.
Ability ability = new DiscardsACardPlayerTriggeredAbility(new DoIfCostPaid(new MayTapOrUntapTargetEffect(), new ManaCostsImpl("{1}{U}")), true);
Ability ability = new DiscardCardPlayerTriggeredAbility(new DoIfCostPaid(new MayTapOrUntapTargetEffect(), new ManaCostsImpl("{1}{U}")), true);
ability.addTarget(new TargetPermanent());
this.addAbility(ability);

View file

@ -43,6 +43,7 @@ public final class Commander2019Edition extends ExpansionSet {
cards.add(new SetCardInfo("Bloodhall Priest", 188, Rarity.RARE, mage.cards.b.BloodhallPriest.class));
cards.add(new SetCardInfo("Blossoming Sands", 231, Rarity.COMMON, mage.cards.b.BlossomingSands.class));
cards.add(new SetCardInfo("Bojuka Bog", 232, Rarity.COMMON, mage.cards.b.BojukaBog.class));
cards.add(new SetCardInfo("Bone Miser", 15, Rarity.RARE, mage.cards.b.BoneMiser.class));
cards.add(new SetCardInfo("Boneyard Parley", 107, Rarity.MYTHIC, mage.cards.b.BoneyardParley.class));
cards.add(new SetCardInfo("Boros Garrison", 233, Rarity.COMMON, mage.cards.b.BorosGarrison.class));
cards.add(new SetCardInfo("Boros Guildgate", 234, Rarity.COMMON, mage.cards.b.BorosGuildgate.class));

View file

@ -0,0 +1,53 @@
package mage.abilities.effects.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
* @author TheElk801
*/
public class DiscardCardControllerTriggeredAbility extends TriggeredAbilityImpl {
private final FilterCard filter;
public DiscardCardControllerTriggeredAbility(Effect effect, boolean isOptional) {
this(effect, isOptional, StaticFilters.FILTER_CARD);
}
public DiscardCardControllerTriggeredAbility(Effect effect, boolean isOptional, FilterCard filter) {
super(Zone.BATTLEFIELD, effect, isOptional);
this.filter = filter;
}
private DiscardCardControllerTriggeredAbility(final DiscardCardControllerTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
}
@Override
public DiscardCardControllerTriggeredAbility copy() {
return new DiscardCardControllerTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DISCARDED_CARD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(getControllerId())
&& filter.match(game.getCard(event.getTargetId()), getId(), getControllerId(), game);
}
@Override
public String getRule() {
return "Whenever you discard " + filter.getMessage() + ", " + super.getRule();
}
}

View file

@ -1,8 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.abilities.effects.common;
import mage.abilities.TriggeredAbilityImpl;
@ -13,31 +8,30 @@ import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author jeffwadsworth
*/
public class DiscardsACardPlayerTriggeredAbility extends TriggeredAbilityImpl {
public class DiscardCardPlayerTriggeredAbility extends TriggeredAbilityImpl {
private SetTargetPointer setTargetPointer;
public DiscardsACardPlayerTriggeredAbility(Effect effect, boolean isOptional) {
public DiscardCardPlayerTriggeredAbility(Effect effect, boolean isOptional) {
this(effect, isOptional, SetTargetPointer.NONE);
}
public DiscardsACardPlayerTriggeredAbility(Effect effect, boolean isOptional, SetTargetPointer setTargetPointer) {
public DiscardCardPlayerTriggeredAbility(Effect effect, boolean isOptional, SetTargetPointer setTargetPointer) {
super(Zone.BATTLEFIELD, effect, isOptional);
this.setTargetPointer = setTargetPointer;
}
public DiscardsACardPlayerTriggeredAbility(final DiscardsACardPlayerTriggeredAbility ability) {
private DiscardCardPlayerTriggeredAbility(final DiscardCardPlayerTriggeredAbility ability) {
super(ability);
this.setTargetPointer = ability.setTargetPointer;
}
@Override
public DiscardsACardPlayerTriggeredAbility copy() {
return new DiscardsACardPlayerTriggeredAbility(this);
public DiscardCardPlayerTriggeredAbility copy() {
return new DiscardCardPlayerTriggeredAbility(this);
}
@Override
@ -52,6 +46,6 @@ import mage.game.events.GameEvent;
@Override
public String getRule() {
return "Whenever player discards a card, " + super.getRule();
return "Whenever a player discards a card, " + super.getRule();
}
}