fix test failure

This commit is contained in:
Evan Kranzler 2022-10-15 10:56:39 -04:00
parent d8e3233cde
commit fb11a59099
2 changed files with 18 additions and 20 deletions

View file

@ -22,10 +22,10 @@ public class ConditionalManaTest extends CardTestPlayerBase {
@Test @Test
public void testNormalUse() { public void testNormalUse() {
setStrictChooseMode(true); setStrictChooseMode(true);
// {T}: Add one mana of any color. Spend this mana only to cast a multicolored spell. // {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); addCard(Zone.BATTLEFIELD, playerA, "Pillar of the Paruns", 2);
// Target player gains 7 life. // Target player gains 7 life.
addCard(Zone.HAND, playerA, "Heroes' Reunion", 1); // Instant {G}{W} addCard(Zone.HAND, playerA, "Heroes' Reunion", 1); // Instant {G}{W}
@ -356,11 +356,11 @@ public class ConditionalManaTest extends CardTestPlayerBase {
assertLife(playerB, 20 - 3); assertLife(playerB, 20 - 3);
} }
@Test @Test
public void testTwoConditionalMana(){ public void testTwoConditionalMana() {
setStrictChooseMode(true); setStrictChooseMode(true);
// At the beginning of your upkeep, look at the top card of your library. You may put that card into your graveyard. // 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. // 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} 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}. // {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, "Rosheen Meanderer", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1); addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2); addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2);
setChoice(playerA, false); // Put [Top Card of Library] into your graveyard?
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute(); execute();
assertPermanentCount(playerA, "Titans' Nest", 1); assertPermanentCount(playerA, "Titans' Nest", 1);
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame); ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 4, manaOptions.size()); Assert.assertEquals("mana variations don't fit", 4, manaOptions.size());
assertManaOptions("{R}", manaOptions); assertManaOptions("{R}", manaOptions);
assertManaOptions("{C}{C}{R}[{TitansNestManaCondition}]", manaOptions); assertManaOptions("{C}{C}{C}{R}[{TitansNestManaCondition}]", manaOptions);
assertManaOptions("{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}]", manaOptions); assertManaOptions("{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}]", manaOptions);
assertManaOptions("{C}{C}{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}{TitansNestManaCondition}]", manaOptions); assertManaOptions("{C}{C}{C}{C}{C}{C}{C}{R}[{RosheenMeandererManaCondition}{TitansNestManaCondition}]", manaOptions);
} }
@Test @Test

View file

@ -3503,7 +3503,7 @@ public abstract class PlayerImpl implements Player, Serializable {
* @param ability The ability to pay for. * @param ability The ability to pay for.
* @param availableMana The available mana. * @param availableMana The available mana.
* @param game The game to calculate this for. * @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) { protected boolean canPayMinimumManaCost(ActivatedAbility ability, ManaOptions availableMana, Game game) {
ManaOptions abilityOptions = ability.getMinimumCostToActivate(playerId, game); // All possible combinations of mana costs 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 availableMana The mana available for payments.
* @param ability The ability to play it by. * @param ability The ability to play it by.
* @param game The game to check for. * @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) { protected boolean canPlayCardByAlternateCost(Card sourceObject, ManaOptions availableMana, Ability ability, Game game) {
// TODO: Why is the "sourceObject instanceof Permanent" in there? // 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)")); + " to PUT on the BOTTOM of your library (Scry)"));
chooseTarget(Outcome.Benefit, cards, target, source, game); chooseTarget(Outcome.Benefit, cards, target, source, game);
putCardsOnBottomOfLibrary(new CardsImpl(target.getTargets()), game, source, true); putCardsOnBottomOfLibrary(new CardsImpl(target.getTargets()), game, source, true);
cards.removeAll(target.getTargets()); cards.retainZone(Zone.LIBRARY, game);
putCardsOnTopOfLibrary(cards, game, source, true); putCardsOnTopOfLibrary(cards, game, source, true);
} }
game.fireEvent(new GameEvent(GameEvent.EventType.SCRIED, getId(), source, getId(), event.getAmount(), 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())); cards.addAll(getLibrary().getTopCards(game, event.getAmount()));
if (!cards.isEmpty()) { if (!cards.isEmpty()) {
TargetCard target = new TargetCard(0, cards.size(), Zone.LIBRARY, 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); chooseTarget(Outcome.Benefit, cards, target, source, game);
moveCards(new CardsImpl(target.getTargets()), Zone.GRAVEYARD, 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); putCardsOnTopOfLibrary(cards, game, source, true);
} }
game.fireEvent(new GameEvent(GameEvent.EventType.SURVEILED, getId(), source, getId(), event.getAmount(), true)); game.fireEvent(new GameEvent(GameEvent.EventType.SURVEILED, getId(), source, getId(), event.getAmount(), true));