From 60269cfcbfb4ef7c8b0aa1aeb8e26eb60851d1ab Mon Sep 17 00:00:00 2001 From: Daniel Bomar Date: Tue, 8 Nov 2022 18:43:34 -0600 Subject: [PATCH] [BRO] Implemented No One Left Behind --- .../src/mage/cards/n/NoOneLeftBehind.java | 74 +++++++++++++++++++ Mage.Sets/src/mage/sets/TheBrothersWar.java | 1 + 2 files changed, 75 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/n/NoOneLeftBehind.java diff --git a/Mage.Sets/src/mage/cards/n/NoOneLeftBehind.java b/Mage.Sets/src/mage/cards/n/NoOneLeftBehind.java new file mode 100644 index 00000000000..988be338d40 --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NoOneLeftBehind.java @@ -0,0 +1,74 @@ +package mage.cards.n; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.stack.StackObject; +import mage.target.Target; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author weirddan455 + */ +public final class NoOneLeftBehind extends CardImpl { + + public NoOneLeftBehind(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}"); + + // This spell costs {3} less to cast if it targets a creature card with mana value 3 or less. + this.addAbility(new SimpleStaticAbility( + Zone.ALL, new SpellCostReductionSourceEffect(3, NoOneLeftBehindCondition.instance).setCanWorksOnStackOnly(true) + ).setRuleAtTheTop(true)); + + // Return target creature card from your graveyard to the battlefield. + this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect()); + this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD)); + } + + private NoOneLeftBehind(final NoOneLeftBehind card) { + super(card); + } + + @Override + public NoOneLeftBehind copy() { + return new NoOneLeftBehind(this); + } +} + +enum NoOneLeftBehindCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + StackObject sourceSpell = game.getStack().getStackObject(source.getSourceId()); + if (sourceSpell == null) { + return false; + } + for (Target target : sourceSpell.getStackAbility().getTargets()) { + for (UUID targetId : target.getTargets()) { + Card card = game.getCard(targetId); + if (card != null && card.isCreature(game) && card.getManaValue() <= 3) { + return true; + } + } + } + return false; + } + + @Override + public String toString() { + return "it targets a creature card with mana value 3 or less"; + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWar.java b/Mage.Sets/src/mage/sets/TheBrothersWar.java index 64a13bb48ec..126e5df1c46 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWar.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWar.java @@ -185,6 +185,7 @@ public final class TheBrothersWar extends ExpansionSet { cards.add(new SetCardInfo("Moment of Defiance", 108, Rarity.COMMON, mage.cards.m.MomentOfDefiance.class)); cards.add(new SetCardInfo("Monastery Swiftspear", 144, Rarity.UNCOMMON, mage.cards.m.MonasterySwiftspear.class)); cards.add(new SetCardInfo("Mountain", 274, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("No One Left Behind", 109, Rarity.UNCOMMON, mage.cards.n.NoOneLeftBehind.class)); cards.add(new SetCardInfo("Obliterating Bolt", 145, Rarity.UNCOMMON, mage.cards.o.ObliteratingBolt.class)); cards.add(new SetCardInfo("Obstinate Baloth", 187, Rarity.UNCOMMON, mage.cards.o.ObstinateBaloth.class)); cards.add(new SetCardInfo("Over the Top", 146, Rarity.RARE, mage.cards.o.OverTheTop.class));