From 5654af91db5076059eaada6f6237332761f11433 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 22 Jan 2021 10:44:52 -0500 Subject: [PATCH] [KHM] Implemented Blessing of Frost --- .../src/mage/cards/b/BlessingOfFrost.java | 96 +++++++++++++++++++ Mage.Sets/src/mage/sets/Kaldheim.java | 1 + 2 files changed, 97 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BlessingOfFrost.java diff --git a/Mage.Sets/src/mage/cards/b/BlessingOfFrost.java b/Mage.Sets/src/mage/cards/b/BlessingOfFrost.java new file mode 100644 index 0000000000..e4cb4dbc1a --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BlessingOfFrost.java @@ -0,0 +1,96 @@ +package mage.cards.b; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.Outcome; +import mage.constants.SuperType; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetAmount; +import mage.target.common.TargetCreaturePermanentAmount; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BlessingOfFrost extends CardImpl { + + public BlessingOfFrost(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}"); + + this.addSuperType(SuperType.SNOW); + + // Distribute X +1/+1 counters among any number of creatures you control, where X is the amount of {S} spent to cast this spell. Then draw a card for each creature you control with power 4 or greater. + this.getSpellAbility().addEffect(new BlessingOfFrostEffect()); + } + + private BlessingOfFrost(final BlessingOfFrost card) { + super(card); + } + + @Override + public BlessingOfFrost copy() { + return new BlessingOfFrost(this); + } +} + +class BlessingOfFrostEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(); + + static { + filter.add(new PowerPredicate(ComparisonType.MORE_THAN, 3)); + } + + BlessingOfFrostEffect() { + super(Outcome.Benefit); + staticText = "Distribute X +1/+1 counters among any number of creatures you control, " + + "where X is the amount of {S} spent to cast this spell. " + + "Then draw a card for each creature you control with power 4 or greater."; + } + + private BlessingOfFrostEffect(final BlessingOfFrostEffect effect) { + super(effect); + } + + @Override + public BlessingOfFrostEffect copy() { + return new BlessingOfFrostEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int snow = source.getManaCostsToPay().getUsedManaToPay().getSnow(); + if (snow > 0) { + TargetAmount target = new TargetCreaturePermanentAmount(snow); + target.setNotTarget(true); + player.choose(outcome, target, source.getSourceId(), game); + for (UUID targetId : target.getTargets()) { + Permanent permanent = game.getPermanent(targetId); + if (permanent == null) { + continue; + } + permanent.addCounters(CounterType.P1P1.createInstance(target.getTargetAmount(targetId)), source, game); + } + } + game.applyEffects(); + player.drawCards(game.getBattlefield().count( + filter, source.getSourceId(), source.getControllerId(), game + ), source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 8a9c113292..f057a9b28b 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -103,6 +103,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Bind the Monster", 48, Rarity.COMMON, mage.cards.b.BindTheMonster.class)); cards.add(new SetCardInfo("Binding the Old Gods", 206, Rarity.UNCOMMON, mage.cards.b.BindingTheOldGods.class)); cards.add(new SetCardInfo("Birgi, God of Storytelling", 123, Rarity.RARE, mage.cards.b.BirgiGodOfStorytelling.class)); + 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("Bloodline Pretender", 235, Rarity.UNCOMMON, mage.cards.b.BloodlinePretender.class));