From 36ae9220b8bdc5a2b7cc359a7856c5dda3c459c9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 6 Apr 2021 08:40:06 -0400 Subject: [PATCH] [STX] Implemented Culling Ritual --- Mage.Sets/src/mage/cards/c/CullingRitual.java | 92 +++++++++++++++++++ .../mage/sets/StrixhavenSchoolOfMages.java | 1 + 2 files changed, 93 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CullingRitual.java diff --git a/Mage.Sets/src/mage/cards/c/CullingRitual.java b/Mage.Sets/src/mage/cards/c/CullingRitual.java new file mode 100644 index 0000000000..e32ec6937a --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CullingRitual.java @@ -0,0 +1,92 @@ +package mage.cards.c; + +import mage.Mana; +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.ManaType; +import mage.constants.Outcome; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterNonlandPermanent; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CullingRitual extends CardImpl { + + public CullingRitual(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{G}"); + + // Destroy each nonland permanent with mana value 2 or less. Add {B} or {G} for each permanent destroyed this way. + this.getSpellAbility().addEffect(new CullingRitualEffect()); + } + + private CullingRitual(final CullingRitual card) { + super(card); + } + + @Override + public CullingRitual copy() { + return new CullingRitual(this); + } +} + +class CullingRitualEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterNonlandPermanent(); + + static { + filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 3)); + } + + CullingRitualEffect() { + super(Outcome.Benefit); + staticText = "destroy each nonland permanent with mana value 2 or less. " + + "Add {B} or {G} for each permanent destroyed this way"; + } + + private CullingRitualEffect(final CullingRitualEffect effect) { + super(effect); + } + + @Override + public CullingRitualEffect copy() { + return new CullingRitualEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + int counter = 0; + for (Permanent permanent : game.getBattlefield().getActivePermanents( + filter, source.getControllerId(), source.getSourceId(), game + )) { + counter += permanent.destroy(source, game, false) ? 1 : 0; + } + if (counter == 0) { + return false; + } + int black = player.getAmount( + 0, counter, counter + " permanents were destroyed, " + + "choose the amount of black mana to produce (the rest will be green)", game + ); + Mana mana = new Mana(ManaType.BLACK, black); + if (black < counter) { + mana.add(new Mana(ManaType.GREEN, counter - black)); + } + player.getManaPool().addMana(mana, game, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index ba04bb2c11..a916a59727 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -69,6 +69,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { cards.add(new SetCardInfo("Cram Session", 170, Rarity.COMMON, mage.cards.c.CramSession.class)); cards.add(new SetCardInfo("Creative Outburst", 171, Rarity.UNCOMMON, mage.cards.c.CreativeOutburst.class)); cards.add(new SetCardInfo("Crushing Disappointment", 68, Rarity.COMMON, mage.cards.c.CrushingDisappointment.class)); + cards.add(new SetCardInfo("Culling Ritual", 172, Rarity.RARE, mage.cards.c.CullingRitual.class)); cards.add(new SetCardInfo("Culmination of Studies", 173, Rarity.RARE, mage.cards.c.CulminationOfStudies.class)); cards.add(new SetCardInfo("Curate", 40, Rarity.COMMON, mage.cards.c.Curate.class)); cards.add(new SetCardInfo("Daemogoth Titan", 174, Rarity.RARE, mage.cards.d.DaemogothTitan.class));