From f22755d44d623540b7724ac13172145676bf83df Mon Sep 17 00:00:00 2001 From: Jmlundeen <98545818+Jmlundeen@users.noreply.github.com> Date: Sat, 8 Mar 2025 11:38:26 -0600 Subject: [PATCH] [DFT] Implement Riverchurn Monument (#13405) * fix MillCardsTargetEffect to work with multiple targets --- .../src/mage/cards/r/RiverchurnMonument.java | 88 +++++++++++++++++++ Mage.Sets/src/mage/sets/Aetherdrift.java | 3 + .../effects/common/MillCardsTargetEffect.java | 13 +-- 3 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/r/RiverchurnMonument.java diff --git a/Mage.Sets/src/mage/cards/r/RiverchurnMonument.java b/Mage.Sets/src/mage/cards/r/RiverchurnMonument.java new file mode 100644 index 00000000000..d9f211b9bda --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RiverchurnMonument.java @@ -0,0 +1,88 @@ +package mage.cards.r; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.MillCardsTargetEffect; +import mage.abilities.keyword.ExhaustAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.targetpointer.EachTargetPointer; + +/** + * + * @author Jmlundeen + */ +public final class RiverchurnMonument extends CardImpl { + + public RiverchurnMonument(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{U}"); + + + // {1}, {T}: Any number of target players each mill two cards. + Effect effect = new MillCardsTargetEffect(2); + effect.setTargetPointer(new EachTargetPointer()); + effect.setText("Any number of target players each mill two cards. " + + "(Each of them puts the top two cards of their library into their graveyard.)"); + Ability ability = new SimpleActivatedAbility(effect, new ManaCostsImpl<>("{1}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetPlayer(0, Integer.MAX_VALUE, false)); + this.addAbility(ability); + + // Exhaust -- {2}{U}{U}, {T}: Any number of target players each mill cards equal to the number of cards in their graveyard. + Effect exhaustEffect = new RiverchurnMonumentEffect(); + exhaustEffect.setTargetPointer(new EachTargetPointer()); + exhaustEffect.setText("Any number of target players each mill cards equal to the number of cards in their graveyard."); + Ability exhaustAbility = new ExhaustAbility(exhaustEffect, new ManaCostsImpl<>("{2}{U}{U}")); + exhaustAbility.addCost(new TapSourceCost()); + exhaustAbility.addTarget(new TargetPlayer(0, Integer.MAX_VALUE, false)); + this.addAbility(exhaustAbility); + } + + private RiverchurnMonument(final RiverchurnMonument card) { + super(card); + } + + @Override + public RiverchurnMonument copy() { + return new RiverchurnMonument(this); + } +} + +class RiverchurnMonumentEffect extends OneShotEffect { + + public RiverchurnMonumentEffect() { + super(Outcome.Detriment); + this.staticText = "Any number of target players each mill cards equal to the number of cards in their graveyard."; + } + + public RiverchurnMonumentEffect(final RiverchurnMonumentEffect effect) { + super(effect); + } + + @Override + public RiverchurnMonumentEffect copy() { + return new RiverchurnMonumentEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID playerId : getTargetPointer().getTargets(game, source)) { + Player player = game.getPlayer(playerId); + if (player != null) { + player.millCards(player.getGraveyard().size(), source, game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Aetherdrift.java b/Mage.Sets/src/mage/sets/Aetherdrift.java index f16262aba1f..76d348b8c14 100644 --- a/Mage.Sets/src/mage/sets/Aetherdrift.java +++ b/Mage.Sets/src/mage/sets/Aetherdrift.java @@ -228,6 +228,9 @@ public final class Aetherdrift extends ExpansionSet { cards.add(new SetCardInfo("Rise from the Wreck", 178, Rarity.UNCOMMON, mage.cards.r.RiseFromTheWreck.class)); cards.add(new SetCardInfo("Risen Necroregent", 102, Rarity.UNCOMMON, mage.cards.r.RisenNecroregent.class)); cards.add(new SetCardInfo("Risky Shortcut", 103, Rarity.COMMON, mage.cards.r.RiskyShortcut.class)); + cards.add(new SetCardInfo("Riverchurn Monument", 57, Rarity.RARE, mage.cards.r.RiverchurnMonument.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Riverchurn Monument", 381, Rarity.RARE, mage.cards.r.RiverchurnMonument.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Riverchurn Monument", 440, Rarity.RARE, mage.cards.r.RiverchurnMonument.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Riverpyre Verge", 260, Rarity.RARE, mage.cards.r.RiverpyreVerge.class)); cards.add(new SetCardInfo("Road Rage", 145, Rarity.UNCOMMON, mage.cards.r.RoadRage.class)); cards.add(new SetCardInfo("Roadside Assistance", 26, Rarity.UNCOMMON, mage.cards.r.RoadsideAssistance.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/MillCardsTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/MillCardsTargetEffect.java index bd5fa91f6fa..25f32e64e2c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/MillCardsTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/MillCardsTargetEffect.java @@ -10,6 +10,8 @@ import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; +import java.util.UUID; + /** * @author LevelX2 */ @@ -38,12 +40,13 @@ public class MillCardsTargetEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); - if (player != null) { - player.millCards(numberCards.calculate(game, source, this), source, game); - return true; + for (UUID playerId : getTargetPointer().getTargets(game, source)) { + Player player = game.getPlayer(playerId); + if (player != null) { + player.millCards(numberCards.calculate(game, source, this), source, game); + } } - return false; + return true; } @Override