diff --git a/Mage.Sets/src/mage/cards/e/EventidesShadow.java b/Mage.Sets/src/mage/cards/e/EventidesShadow.java new file mode 100644 index 00000000000..380bcd836e5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EventidesShadow.java @@ -0,0 +1,87 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.RemoveUpToAmountCountersEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterPermanent; +import mage.filter.predicate.permanent.CounterAnyPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class EventidesShadow extends CardImpl { + + public EventidesShadow(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}"); + + // Remove any number of counters from among permanents on the battlefield. You draw cards and lose life equal to the number of counters removed this way. + this.getSpellAbility().addEffect(new EventidesShadowEffect()); + } + + private EventidesShadow(final EventidesShadow card) { + super(card); + } + + @Override + public EventidesShadow copy() { + return new EventidesShadow(this); + } +} + +class EventidesShadowEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterPermanent("permanents"); + + static { + filter.add(CounterAnyPredicate.instance); + } + + EventidesShadowEffect() { + super(Outcome.Benefit); + staticText = "remove any number of counters from among permanents on the battlefield. " + + "You draw cards and lose life equal to the number of counters removed this way"; + } + + private EventidesShadowEffect(final EventidesShadowEffect effect) { + super(effect); + } + + @Override + public EventidesShadowEffect copy() { + return new EventidesShadowEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true); + target.withChooseHint("to remove counters from"); + player.choose(outcome, target, source, game); + int total = 0; + for (UUID targetId : target.getTargets()) { + Permanent permanent = game.getPermanent(targetId); + total += RemoveUpToAmountCountersEffect.doRemoval(Integer.MAX_VALUE, targetId, player, game, source); + } + if (total < 1) { + return false; + } + game.processAction(); + player.drawCards(total, source, game); + game.processAction(); + player.loseLife(total, game, source, false); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/LorwynEclipsedCommander.java b/Mage.Sets/src/mage/sets/LorwynEclipsedCommander.java index ba7d2034cfe..4b446cf337e 100644 --- a/Mage.Sets/src/mage/sets/LorwynEclipsedCommander.java +++ b/Mage.Sets/src/mage/sets/LorwynEclipsedCommander.java @@ -64,6 +64,8 @@ public final class LorwynEclipsedCommander extends ExpansionSet { cards.add(new SetCardInfo("Elemental Spectacle", 15, Rarity.RARE, mage.cards.e.ElementalSpectacle.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Elemental Spectacle", 35, Rarity.RARE, mage.cards.e.ElementalSpectacle.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Endurance", 51, Rarity.MYTHIC, mage.cards.e.Endurance.class)); + cards.add(new SetCardInfo("Eventide's Shadow", 28, Rarity.RARE, mage.cards.e.EventidesShadow.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Eventide's Shadow", 8, Rarity.RARE, mage.cards.e.EventidesShadow.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Everlasting Torment", 121, Rarity.RARE, mage.cards.e.EverlastingTorment.class)); cards.add(new SetCardInfo("Evolution Sage", 105, Rarity.UNCOMMON, mage.cards.e.EvolutionSage.class)); cards.add(new SetCardInfo("Exotic Orchard", 148, Rarity.RARE, mage.cards.e.ExoticOrchard.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/RemoveUpToAmountCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RemoveUpToAmountCountersEffect.java index 710d71e9bbd..47df31ffc8f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/RemoveUpToAmountCountersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/RemoveUpToAmountCountersEffect.java @@ -64,6 +64,13 @@ public class RemoveUpToAmountCountersEffect extends OneShotEffect { return 0; } + private static String getIdName(Permanent permanent, Player player) { + if (permanent != null) { + return permanent.getIdName(); + } + return player.getName(); + } + public static int doRemoval(int amount, UUID targetId, Player controller, Game game, Ability source) { Permanent permanent = game.getPermanent(targetId); Player player = game.getPlayer(targetId); @@ -75,8 +82,8 @@ public class RemoveUpToAmountCountersEffect extends OneShotEffect { return 0; } List counterList = controller.getMultiAmount( - Outcome.UnboostCreature, toChoose, 0, 0, - amount, MultiAmountType.REMOVE_COUNTERS, game + Outcome.UnboostCreature, toChoose, 0, 0, amount, + new MultiAmountType("Choose counters", "Remove counters (from " + getIdName(permanent, player) + ')'), game ); int total = 0; for (int i = 0; i < toChoose.size(); i++) {