[BRO] Implemented No One Left Behind

This commit is contained in:
Daniel Bomar 2022-11-08 18:43:34 -06:00
parent 5a8bea6e9c
commit 60269cfcbf
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 75 additions and 0 deletions

View file

@ -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";
}
}

View file

@ -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));