[DFT] Implement Riverchurn Monument (#13405)

* fix MillCardsTargetEffect to work with multiple targets
This commit is contained in:
Jmlundeen 2025-03-08 11:38:26 -06:00 committed by GitHub
parent f9aa8c1527
commit f22755d44d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 99 additions and 5 deletions

View file

@ -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;
}
}

View file

@ -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));

View file

@ -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