mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Once Upon A Time - Added test (#6954).
This commit is contained in:
parent
d3ba7d4dd5
commit
0d83a8e09a
2 changed files with 91 additions and 2 deletions
|
@ -70,7 +70,7 @@ enum OnceUponATimeCondition implements Condition {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
OnceUponATimeWatcher watcher = game.getState().getWatcher(OnceUponATimeWatcher.class);
|
||||
return watcher != null && watcher.getSpellsCastThisTurn(source.getControllerId());
|
||||
return watcher != null && watcher.getSpellsCastThisGame(source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ class OnceUponATimeWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean getSpellsCastThisTurn(UUID playerId) {
|
||||
public boolean getSpellsCastThisGame(UUID playerId) {
|
||||
return !castSpells.contains(playerId);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
package org.mage.test.cards.single.eld;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class OnceUponATimeTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void test_castRegularly() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion");
|
||||
addCard(Zone.LIBRARY, playerA, "Plains", 4);
|
||||
skipInitShuffling();
|
||||
|
||||
// If this spell is the first spell you've cast this game, you may cast it without paying its mana cost.
|
||||
// Look at the top five cards of your library.
|
||||
// You may reveal a creature or land card from among them and put it into your hand.
|
||||
// Put the rest on the bottom of your library in a random order.
|
||||
addCard(Zone.HAND, playerA, "Once Upon a Time"); // Instant {1}{G}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
addCard(Zone.HAND, playerA, "Forest", 1);
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Forest");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Once Upon a Time");
|
||||
|
||||
setChoice(playerA, "No"); // Cast without paying its mana cost?
|
||||
|
||||
setChoice(playerA, "Yes"); // Do you wish to reveal a creature or land card and put into your hand?
|
||||
setChoice(playerA, "Silvercoat Lion");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, "Once Upon a Time", 1);
|
||||
assertTappedCount("Forest", true, 2);
|
||||
assertHandCount(playerA, "Silvercoat Lion", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_castForFree() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion");
|
||||
addCard(Zone.LIBRARY, playerA, "Plains", 4);
|
||||
|
||||
addCard(Zone.LIBRARY, playerB, "Silvercoat Lion", 5);
|
||||
|
||||
skipInitShuffling();
|
||||
|
||||
// If this spell is the first spell you've cast this game, you may cast it without paying its mana cost.
|
||||
// Look at the top five cards of your library.
|
||||
// You may reveal a creature or land card from among them and put it into your hand.
|
||||
// Put the rest on the bottom of your library in a random order.
|
||||
addCard(Zone.HAND, playerA, "Once Upon a Time"); // Instant {1}{G}
|
||||
addCard(Zone.HAND, playerB, "Once Upon a Time"); // Instant {1}{G}
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Once Upon a Time");
|
||||
setChoice(playerA, "Yes"); // Cast without paying its mana cost?
|
||||
setChoice(playerA, "Yes"); // Do you wish to reveal a creature or land card and put into your hand?
|
||||
setChoice(playerA, "Silvercoat Lion");
|
||||
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Once Upon a Time");
|
||||
setChoice(playerB, "Yes"); // Cast without paying its mana cost?
|
||||
setChoice(playerB, "Yes"); // Do you wish to reveal a creature or land card and put into your hand?
|
||||
setChoice(playerB, "Silvercoat Lion");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
|
||||
assertGraveyardCount(playerA, "Once Upon a Time", 1);
|
||||
assertGraveyardCount(playerB, "Once Upon a Time", 1);
|
||||
|
||||
assertHandCount(playerA, "Silvercoat Lion", 1);
|
||||
assertHandCount(playerB, "Silvercoat Lion", 2);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue