From fb11a59099e30ddb6b574dbf2bff0f4796a40b1e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 15 Oct 2022 10:56:39 -0400 Subject: [PATCH] fix test failure --- .../mana/conditional/ConditionalManaTest.java | 27 +++++++++---------- .../main/java/mage/players/PlayerImpl.java | 11 ++++---- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java index 56498dcbbd..4e5add964b 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/conditional/ConditionalManaTest.java @@ -22,10 +22,10 @@ public class ConditionalManaTest extends CardTestPlayerBase { @Test public void testNormalUse() { setStrictChooseMode(true); - + // {T}: Add one mana of any color. Spend this mana only to cast a multicolored spell. addCard(Zone.BATTLEFIELD, playerA, "Pillar of the Paruns", 2); - + // Target player gains 7 life. addCard(Zone.HAND, playerA, "Heroes' Reunion", 1); // Instant {G}{W} @@ -356,11 +356,11 @@ public class ConditionalManaTest extends CardTestPlayerBase { assertLife(playerB, 20 - 3); } - + @Test - public void testTwoConditionalMana(){ + public void testTwoConditionalMana() { setStrictChooseMode(true); - + // At the beginning of your upkeep, look at the top card of your library. You may put that card into your graveyard. // Exile a card from your graveyard: Add {C}. Spend this mana only to cast a colored spell without {X} in its mana cost. addCard(Zone.BATTLEFIELD, playerA, "Titans' Nest"); // Enchantment {1}{B}{G}{U} @@ -368,23 +368,20 @@ public class ConditionalManaTest extends CardTestPlayerBase { // {T}: Add {C}{C}{C}{C}. Spend this mana only on costs that contain {X}. addCard(Zone.BATTLEFIELD, playerA, "Rosheen Meanderer", 1); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); - + addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2); - - - setChoice(playerA, false); // Put [Top Card of Library] into your graveyard? - + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); execute(); assertPermanentCount(playerA, "Titans' Nest", 1); - + ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame); Assert.assertEquals("mana variations don't fit", 4, manaOptions.size()); - assertManaOptions("{R}", manaOptions); - assertManaOptions("{C}{C}{R}[{TitansNestManaCondition}]", manaOptions); - assertManaOptions("{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}]", manaOptions); - assertManaOptions("{C}{C}{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}{TitansNestManaCondition}]", manaOptions); + assertManaOptions("{R}", manaOptions); + assertManaOptions("{C}{C}{C}{R}[{TitansNestManaCondition}]", manaOptions); + assertManaOptions("{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}]", manaOptions); + assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}{TitansNestManaCondition}]", manaOptions); } @Test diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 627a6458e0..bf9d5b560a 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -3503,7 +3503,7 @@ public abstract class PlayerImpl implements Player, Serializable { * @param ability The ability to pay for. * @param availableMana The available mana. * @param game The game to calculate this for. - * @return Boolean. True if the minimum can be paid, false otherwise. + * @return Boolean. True if the minimum can be paid, false otherwise. */ protected boolean canPayMinimumManaCost(ActivatedAbility ability, ManaOptions availableMana, Game game) { ManaOptions abilityOptions = ability.getMinimumCostToActivate(playerId, game); // All possible combinations of mana costs @@ -3604,7 +3604,7 @@ public abstract class PlayerImpl implements Player, Serializable { * @param availableMana The mana available for payments. * @param ability The ability to play it by. * @param game The game to check for. - * @return Boolean, true if the card can be played by *any* of the available alternative costs, false otherwise. + * @return Boolean, true if the card can be played by *any* of the available alternative costs, false otherwise. */ protected boolean canPlayCardByAlternateCost(Card sourceObject, ManaOptions availableMana, Ability ability, Game game) { // TODO: Why is the "sourceObject instanceof Permanent" in there? @@ -5015,7 +5015,7 @@ public abstract class PlayerImpl implements Player, Serializable { + " to PUT on the BOTTOM of your library (Scry)")); chooseTarget(Outcome.Benefit, cards, target, source, game); putCardsOnBottomOfLibrary(new CardsImpl(target.getTargets()), game, source, true); - cards.removeAll(target.getTargets()); + cards.retainZone(Zone.LIBRARY, game); putCardsOnTopOfLibrary(cards, game, source, true); } game.fireEvent(new GameEvent(GameEvent.EventType.SCRIED, getId(), source, getId(), event.getAmount(), true)); @@ -5033,10 +5033,11 @@ public abstract class PlayerImpl implements Player, Serializable { cards.addAll(getLibrary().getTopCards(game, event.getAmount())); if (!cards.isEmpty()) { TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, - new FilterCard("cards to PUT into your GRAVEYARD (Surveil)")); + new FilterCard("card " + (cards.size() == 1 ? "" : "s") + + " to PUT into your GRAVEYARD (Surveil)")); chooseTarget(Outcome.Benefit, cards, target, source, game); moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, source, game); - cards.removeAll(target.getTargets()); + cards.retainZone(Zone.LIBRARY, game); putCardsOnTopOfLibrary(cards, game, source, true); } game.fireEvent(new GameEvent(GameEvent.EventType.SURVEILED, getId(), source, getId(), event.getAmount(), true));