diff --git a/Mage.Sets/src/mage/cards/b/BloodOnTheSnow.java b/Mage.Sets/src/mage/cards/b/BloodOnTheSnow.java new file mode 100644 index 00000000000..64f36ed344f --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BloodOnTheSnow.java @@ -0,0 +1,93 @@ +package mage.cards.b; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.Card; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author weirddan455 + */ +public final class BloodOnTheSnow extends CardImpl { + + public BloodOnTheSnow(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{B}"); + + this.addSuperType(SuperType.SNOW); + + // Choose one — + // • Destroy all creatures. + this.getSpellAbility().addEffect(new DestroyAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES)); + + // • Destroy all planeswalkers. + Mode mode = new Mode(new DestroyAllEffect(StaticFilters.FILTER_PERMANENT_PLANESWALKERS)); + + // Then return a creature or planeswalker card with converted mana cost X or less + // from your graveyard to the battlefield, where X is the amount of {S} spent to cast this spell. + this.getSpellAbility().addEffect(new BloodOnTheSnowEffect()); + mode.addEffect(new BloodOnTheSnowEffect()); + this.getSpellAbility().addMode(mode); + this.getSpellAbility().appendToRule( + "Then return a creature or planeswalker card with converted mana cost X or less" + + " from your graveyard to the battlefield, where X is the amount of {S} spent to cast this spell." + ); + } + + private BloodOnTheSnow(final BloodOnTheSnow card) { + super(card); + } + + @Override + public BloodOnTheSnow copy() { + return new BloodOnTheSnow(this); + } +} + +class BloodOnTheSnowEffect extends OneShotEffect { + + public BloodOnTheSnowEffect() { + super(Outcome.PutCardInPlay); + } + + private BloodOnTheSnowEffect(final BloodOnTheSnowEffect effect) { + super(effect); + } + + @Override + public BloodOnTheSnowEffect copy() { + return new BloodOnTheSnowEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int snow = source.getManaCostsToPay().getUsedManaToPay().getSnow(); + FilterCard filter = new FilterCard("a creature or planeswalker card with CMC " + snow + " or less from your graveyard"); + filter.add(Predicates.or(CardType.CREATURE.getPredicate(), CardType.PLANESWALKER.getPredicate())); + filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, snow + 1)); + TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(1, 1, filter, true); + controller.chooseTarget(outcome, target, source, game); + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + controller.moveCards(card, Zone.BATTLEFIELD, source, game); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index a1b7a79bc69..5bfacd795ae 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -106,6 +106,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Blessing of Frost", 161, Rarity.RARE, mage.cards.b.BlessingOfFrost.class)); cards.add(new SetCardInfo("Blightstep Pathway", 252, Rarity.RARE, mage.cards.b.BlightstepPathway.class)); cards.add(new SetCardInfo("Blizzard Brawl", 162, Rarity.UNCOMMON, mage.cards.b.BlizzardBrawl.class)); + cards.add(new SetCardInfo("Blood on the Snow", 79, Rarity.RARE, mage.cards.b.BloodOnTheSnow.class)); cards.add(new SetCardInfo("Bloodline Pretender", 235, Rarity.UNCOMMON, mage.cards.b.BloodlinePretender.class)); cards.add(new SetCardInfo("Bloodsky Berserker", 80, Rarity.UNCOMMON, mage.cards.b.BloodskyBerserker.class)); cards.add(new SetCardInfo("Boreal Outrider", 163, Rarity.UNCOMMON, mage.cards.b.BorealOutrider.class)); diff --git a/Mage/src/main/java/mage/abilities/AbilityImpl.java b/Mage/src/main/java/mage/abilities/AbilityImpl.java index e05f0b362ce..ab6cb79136c 100644 --- a/Mage/src/main/java/mage/abilities/AbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/AbilityImpl.java @@ -72,6 +72,7 @@ public abstract class AbilityImpl implements Ability { protected List hints = new ArrayList<>(); protected Outcome customOutcome = null; // uses for AI decisions instead effects protected MageIdentifier identifier; // used to identify specific ability (e.g. to match with corresponding watcher) + protected String appendToRule = null; public AbilityImpl(AbilityType abilityType, Zone zone) { this.id = UUID.randomUUID(); @@ -742,6 +743,10 @@ public abstract class AbilityImpl implements Ability { return usesStack; } + public void appendToRule(String appendToRule) { + this.appendToRule = appendToRule; + } + @Override public String getRule() { return getRule(false); @@ -785,6 +790,9 @@ public abstract class AbilityImpl implements Ability { if (abilityWord != null) { rule = "" + abilityWord + " — " + Character.toUpperCase(rule.charAt(0)) + rule.substring(1); } + if (appendToRule != null) { + rule = rule.concat(appendToRule); + } return rule; }