[TDM] Implement Rite of Renewal

This commit is contained in:
theelk801 2025-04-13 18:09:01 -04:00
parent e54210ad2e
commit af512ce3f4
4 changed files with 64 additions and 4 deletions

View file

@ -0,0 +1,43 @@
package mage.cards.r;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.effects.common.TargetPlayerShufflesTargetCardsEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInTargetPlayersGraveyard;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RiteOfRenewal extends CardImpl {
public RiteOfRenewal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}");
// Return up to two target permanent cards from your graveyard to your hand. Target player shuffles up to four target cards from their graveyard into their library. Exile Rite of Renewal.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(
0, 2, StaticFilters.FILTER_CARD_PERMANENTS
));
this.getSpellAbility().addEffect(new TargetPlayerShufflesTargetCardsEffect(1));
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new TargetCardInTargetPlayersGraveyard(3, 1));
this.getSpellAbility().addEffect(new ExileSpellEffect());
}
private RiteOfRenewal(final RiteOfRenewal card) {
super(card);
}
@Override
public RiteOfRenewal copy() {
return new RiteOfRenewal(this);
}
}

View file

@ -212,6 +212,7 @@ public final class TarkirDragonstorm extends ExpansionSet {
cards.add(new SetCardInfo("Revival of the Ancestors", 218, Rarity.RARE, mage.cards.r.RevivalOfTheAncestors.class));
cards.add(new SetCardInfo("Riling Dawnbreaker", 21, Rarity.COMMON, mage.cards.r.RilingDawnbreaker.class));
cards.add(new SetCardInfo("Ringing Strike Mastery", 53, Rarity.COMMON, mage.cards.r.RingingStrikeMastery.class));
cards.add(new SetCardInfo("Rite of Renewal", 153, Rarity.UNCOMMON, mage.cards.r.RiteOfRenewal.class));
cards.add(new SetCardInfo("Riverwalk Technique", 54, Rarity.COMMON, mage.cards.r.RiverwalkTechnique.class));
cards.add(new SetCardInfo("Riverwheel Sweep", 219, Rarity.UNCOMMON, mage.cards.r.RiverwheelSweep.class));
cards.add(new SetCardInfo("Roamer's Routine", 154, Rarity.COMMON, mage.cards.r.RoamersRoutine.class));

View file

@ -15,12 +15,20 @@ import mage.util.CardUtil;
*/
public class TargetPlayerShufflesTargetCardsEffect extends OneShotEffect {
private final int targetPlayerIndex;
public TargetPlayerShufflesTargetCardsEffect() {
this(0);
}
public TargetPlayerShufflesTargetCardsEffect(int targetPlayerIndex) {
super(Outcome.Neutral);
this.targetPlayerIndex = targetPlayerIndex;
}
private TargetPlayerShufflesTargetCardsEffect(final TargetPlayerShufflesTargetCardsEffect effect) {
super(effect);
this.targetPlayerIndex = effect.targetPlayerIndex;
}
@Override
@ -30,8 +38,8 @@ public class TargetPlayerShufflesTargetCardsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
Cards cards = new CardsImpl(source.getTargets().get(1).getTargets());
Player targetPlayer = game.getPlayer(source.getTargets().get(targetPlayerIndex).getFirstTarget());
Cards cards = new CardsImpl(source.getTargets().get(targetPlayerIndex + 1).getTargets());
if (targetPlayer != null && !cards.isEmpty()) {
return targetPlayer.shuffleCardsToLibrary(cards, game, source);
}
@ -44,7 +52,7 @@ public class TargetPlayerShufflesTargetCardsEffect extends OneShotEffect {
return staticText;
}
String rule = "target player shuffles ";
int targetNumber = mode.getTargets().get(1).getMaxNumberOfTargets();
int targetNumber = mode.getTargets().get(targetPlayerIndex + 1).getMaxNumberOfTargets();
if (targetNumber == Integer.MAX_VALUE) {
rule += "any number of target cards";
} else {

View file

@ -12,12 +12,20 @@ import java.util.UUID;
*/
public class TargetCardInTargetPlayersGraveyard extends TargetCardInGraveyard {
private final int targetPlayerIndex;
public TargetCardInTargetPlayersGraveyard(int targets) {
this(targets, 0);
}
public TargetCardInTargetPlayersGraveyard(int targets, int targetPlayerIndex) {
super(0, targets, StaticFilters.FILTER_CARD);
this.targetPlayerIndex = targetPlayerIndex;
}
private TargetCardInTargetPlayersGraveyard(final TargetCardInTargetPlayersGraveyard target) {
super(target);
this.targetPlayerIndex = target.targetPlayerIndex;
}
@Override
@ -26,7 +34,7 @@ public class TargetCardInTargetPlayersGraveyard extends TargetCardInGraveyard {
return false;
}
Card card = game.getCard(id);
return card != null && card.isOwnedBy(source.getFirstTarget());
return card != null && card.isOwnedBy(source.getTargets().get(targetPlayerIndex).getFirstTarget());
}
@Override