mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 22:42:03 -08:00
[TDM] Implement Rite of Renewal
This commit is contained in:
parent
e54210ad2e
commit
af512ce3f4
4 changed files with 64 additions and 4 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue