Fix Vault 13 test and card once zcc fix is merged

This commit is contained in:
Steven Knipe 2025-05-31 19:29:21 -07:00
parent 7a3b069d9e
commit 8b29853e4c
3 changed files with 78 additions and 18 deletions

View file

@ -2,9 +2,11 @@ package mage.cards.v;
import mage.abilities.Ability;
import mage.abilities.common.SagaAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileUntilSourceLeavesEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -20,7 +22,9 @@ import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPermanent;
import mage.target.common.TargetCardInExile;
import mage.target.targetadjustment.ForEachOpponentTargetsAdjuster;
import mage.target.targetadjustment.ForEachPlayerTargetsAdjuster;
import mage.target.targetpointer.EachTargetPointer;
import mage.target.targetpointer.FixedTargets;
import mage.util.CardUtil;
import java.util.Optional;
@ -55,9 +59,10 @@ public final class Vault13DwellersJourney extends CardImpl {
triggeredAbility -> {
triggeredAbility.addEffect(new ExileUntilSourceLeavesEffect()
.setText("for each player, exile up to one other target enchantment or " +
"creature that player controls until {this} leaves the battlefield"));
triggeredAbility.addTarget(new TargetPermanent(filter));
triggeredAbility.setTargetAdjuster(new ForEachOpponentTargetsAdjuster());
"creature that player controls until {this} leaves the battlefield")
.setTargetPointer(new EachTargetPointer()));
triggeredAbility.addTarget(new TargetPermanent(0, 1, filter));
triggeredAbility.setTargetAdjuster(new ForEachPlayerTargetsAdjuster(false, false));
}
);
@ -126,7 +131,11 @@ class Vault13DwellersJourneyEffect extends OneShotEffect {
);
cards.retainZone(Zone.EXILED, game);
}
player.putCardsOnBottomOfLibrary(cards, game, source, true);
if (!cards.isEmpty()) {
Effect e = new PutOnLibraryTargetEffect(false);
e.setTargetPointer(new FixedTargets(cards, game));
e.apply(game, source);
}
return true;
}
}

View file

@ -4,6 +4,7 @@ import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
@ -20,6 +21,34 @@ public class Vault13DwellersJourneyTest extends CardTestPlayerBase {
*/
private static final String vault = "Vault 13: Dweller's Journey";
@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay_ReturnOne() {
addCard(Zone.HAND, playerA, vault, 1);
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
addCard(Zone.BATTLEFIELD, playerA, "Memnite");
addCard(Zone.BATTLEFIELD, playerB, "Ornithopter");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, vault);
addTarget(playerA, "Memnite");
addTarget(playerA, TestPlayer.TARGET_SKIP);
checkExileCount("after I: Memnite exiled", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Memnite", 1);
// turn 3
addTarget(playerA, "Mountain"); // for Scry 2
// turn 5
checkExileCount("before III: Memnite exiled", 5, PhaseStep.UPKEEP, playerA, "Memnite", 1);
setStrictChooseMode(true);
setStopAt(5, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Memnite", 1);
assertLife(playerA, 20 + 2);
}
@Ignore // TODO: goal of #11619 is to fix this nicely
@Test
public void test_SimplePlay_Return() {
@ -37,16 +66,14 @@ public class Vault13DwellersJourneyTest extends CardTestPlayerBase {
checkExileCount("after I: Ornithopter exiled", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ornithopter", 1);
// turn 3
setChoice(playerA, "Mountain"); // for Scry 2
addTarget(playerA, "Mountain"); // for Scry 2
// turn 5
checkExileCount("before III: Memnite exiled", 5, PhaseStep.UPKEEP, playerA, "Memnite", 1);
checkExileCount("before III: Ornithopter exiled", 5, PhaseStep.UPKEEP, playerB, "Ornithopter", 1);
setChoice(playerA, "Memnite^Ornithopter");
setStrictChooseMode(true);
setStopAt(8, PhaseStep.END_TURN);
setStopAt(5, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Memnite", 1);
@ -61,24 +88,45 @@ public class Vault13DwellersJourneyTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 4);
addCard(Zone.BATTLEFIELD, playerA, "Memnite");
addCard(Zone.BATTLEFIELD, playerA, "Squire");
addCard(Zone.BATTLEFIELD, playerB, "Vampire Hexmage");
addCard(Zone.BATTLEFIELD, playerB, "Ornithopter");
addCard(Zone.BATTLEFIELD, playerB, "Watchwolf");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, vault);
addTarget(playerA, "Memnite");
addTarget(playerA, "Ornithopter");
checkExileCount("after I: Ornithopter exiled", 1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ornithopter", 1);
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Sacrifice");
addTarget(playerB, vault);
// turn
setChoice(playerA, "Mountain"); // for Scry 2
//Turn 3
addTarget(playerA, "Squire");
addTarget(playerA, "Watchwolf");
checkExileCount("after I x2: Memnite exiled", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Memnite", 1);
checkExileCount("after I x2: Ornithopter exiled", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Ornithopter", 1);
checkExileCount("after I x2: Squire exiled", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, "Squire", 1);
checkExileCount("after I x2: Watchwolf exiled", 3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Watchwolf", 1);
// turn 5
addTarget(playerA, "Mountain"); // for Scry 2
// turn 7
checkExileCount("before III: Memnite exiled", 5, PhaseStep.UPKEEP, playerB, "Memnite", 1);
checkExileCount("before III: Ornithopter exiled", 5, PhaseStep.UPKEEP, playerB, "Ornithopter", 1);
checkExileCount("before III: Squire exiled", 5, PhaseStep.UPKEEP, playerB, "Squire", 1);
checkExileCount("before III: Watchwolf exiled", 5, PhaseStep.UPKEEP, playerB, "Watchwolf", 1);
setChoice(playerA, "Memnite^Ornithopter");
setStrictChooseMode(true);
setStopAt(8, PhaseStep.END_TURN);
setStopAt(7, PhaseStep.END_TURN);
execute();
assertLibraryCount(playerB, "Ornithopter", 1);
assertPermanentCount(playerA, "Memnite", 1);
assertPermanentCount(playerB, "Ornithopter", 1);
assertLibraryCount(playerA, "Squire", 1);
assertLibraryCount(playerB, "Watchwolf", 1);
assertLife(playerA, 20 + 2);
}
}

View file

@ -10,6 +10,7 @@ import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetCardInYourGraveyard;
@ -63,13 +64,15 @@ public class PutOnLibraryTargetEffect extends OneShotEffect {
}
break;
case GRAVEYARD:
Card graveyardCard = game.getCard(targetId);
if (graveyardCard != null) {
cards.add(graveyardCard);
case EXILED:
Card card = game.getCard(targetId);
if (card != null) {
cards.add(card);
}
break;
case STACK:
Card stackSpellCard = game.getSpell(targetId).getCard();
Spell spell = game.getSpell(targetId);
Card stackSpellCard = (spell != null) ? spell.getCard() : null;
if (stackSpellCard != null) {
cards.add(stackSpellCard);
}