diff --git a/Mage.Sets/src/mage/cards/b/BoneMiser.java b/Mage.Sets/src/mage/cards/b/BoneMiser.java new file mode 100644 index 0000000000..3ff1558dd4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BoneMiser.java @@ -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); + } +} diff --git a/Mage.Sets/src/mage/cards/t/TelekineticBonds.java b/Mage.Sets/src/mage/cards/t/TelekineticBonds.java index 7a44bf3114..97010ed385 100644 --- a/Mage.Sets/src/mage/cards/t/TelekineticBonds.java +++ b/Mage.Sets/src/mage/cards/t/TelekineticBonds.java @@ -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); diff --git a/Mage.Sets/src/mage/sets/Commander2019Edition.java b/Mage.Sets/src/mage/sets/Commander2019Edition.java index 247dca91ab..51c59751f5 100644 --- a/Mage.Sets/src/mage/sets/Commander2019Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2019Edition.java @@ -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)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DiscardCardControllerTriggeredAbility.java b/Mage/src/main/java/mage/abilities/effects/common/DiscardCardControllerTriggeredAbility.java new file mode 100644 index 0000000000..71482262d6 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/DiscardCardControllerTriggeredAbility.java @@ -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(); + } +} \ No newline at end of file diff --git a/Mage/src/main/java/mage/abilities/effects/common/DiscardsACardPlayerTriggeredAbility.java b/Mage/src/main/java/mage/abilities/effects/common/DiscardCardPlayerTriggeredAbility.java similarity index 53% rename from Mage/src/main/java/mage/abilities/effects/common/DiscardsACardPlayerTriggeredAbility.java rename to Mage/src/main/java/mage/abilities/effects/common/DiscardCardPlayerTriggeredAbility.java index 5c4ac7641c..a977e752fd 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DiscardsACardPlayerTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DiscardCardPlayerTriggeredAbility.java @@ -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(); } } \ No newline at end of file