From c3adff6bc929b5cc06fc5f7338acf17783a1aba6 Mon Sep 17 00:00:00 2001 From: Evan Kranzler <theelk801@gmail.com> Date: Tue, 31 May 2022 09:03:36 -0400 Subject: [PATCH] [CLB] Implemented Blood Money --- Mage.Sets/src/mage/cards/b/BloodMoney.java | 71 +++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 72 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BloodMoney.java diff --git a/Mage.Sets/src/mage/cards/b/BloodMoney.java b/Mage.Sets/src/mage/cards/b/BloodMoney.java new file mode 100644 index 0000000000..cacf25f81a --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BloodMoney.java @@ -0,0 +1,71 @@ +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.Outcome; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentToken; +import mage.game.permanent.token.TreasureToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BloodMoney extends CardImpl { + + public BloodMoney(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{B}{B}"); + + // Destroy all creatures. For each nontoken creature destroyed this way, create a tapped Treasure token. + this.getSpellAbility().addEffect(new BloodMoneyEffect()); + } + + private BloodMoney(final BloodMoney card) { + super(card); + } + + @Override + public BloodMoney copy() { + return new BloodMoney(this); + } +} + +class BloodMoneyEffect extends OneShotEffect { + + BloodMoneyEffect() { + super(Outcome.Benefit); + staticText = "destroy all creatures. For each nontoken creature destroyed this way, create a tapped Treasure token"; + } + + private BloodMoneyEffect(final BloodMoneyEffect effect) { + super(effect); + } + + @Override + public BloodMoneyEffect copy() { + return new BloodMoneyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int count = 0; + for (Permanent permanent : game.getBattlefield().getActivePermanents( + StaticFilters.FILTER_PERMANENT_CREATURE, + source.getControllerId(), source, game + )) { + if (permanent.destroy(source, game) && !(permanent instanceof PermanentToken)) { + count++; + } + } + if (count > 0) { + new TreasureToken().putOntoBattlefield(count, game, source, source.getControllerId(), true, false); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 43923fe73a..f4e2aa9c8b 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -58,6 +58,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Black Dragon Gate", 347, Rarity.COMMON, mage.cards.b.BlackDragonGate.class)); cards.add(new SetCardInfo("Blade of Selves", 301, Rarity.RARE, mage.cards.b.BladeOfSelves.class)); cards.add(new SetCardInfo("Blessed Hippogriff", 11, Rarity.COMMON, mage.cards.b.BlessedHippogriff.class)); + cards.add(new SetCardInfo("Blood Money", 116, Rarity.MYTHIC, mage.cards.b.BloodMoney.class)); cards.add(new SetCardInfo("Bloodboil Sorcerer", 164, Rarity.UNCOMMON, mage.cards.b.BloodboilSorcerer.class)); cards.add(new SetCardInfo("Blur", 58, Rarity.COMMON, mage.cards.b.Blur.class)); cards.add(new SetCardInfo("Bonecaller Cleric", 117, Rarity.UNCOMMON, mage.cards.b.BonecallerCleric.class));