Updated implementation of Unpredictable Cyclone (#6423)

* updated implementation of Unpredictable Cyclone, refactored drawCard method

* fixed another small implementation error

* added test for Unpredictable Cyclone

* updated Unpredictable Cyclone test
This commit is contained in:
Evan Kranzler 2020-04-16 08:04:21 -04:00 committed by GitHub
parent 80b7f8493b
commit 378dfbf89a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
279 changed files with 465 additions and 378 deletions

View file

@ -0,0 +1,119 @@
package org.mage.test.cards.single;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author TheElk801
*/
public class UnpredictableCycloneTest extends CardTestPlayerBase {
@Test
public void testCyclone() {
// Make sure the card works normally
addCard(Zone.LIBRARY, playerA, "Goblin Piker");
addCard(Zone.LIBRARY, playerA, "Swamp", 10);
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Unpredictable Cyclone");
addCard(Zone.HAND, playerA, "Desert Cerodon");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
setChoice(playerA, "Yes");
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Goblin Piker", 1);
}
@Test
public void testLandCycle() {
// Make sure it doesn't apply to cycling lands
addCard(Zone.LIBRARY, playerA, "Swamp", 10);
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Unpredictable Cyclone");
addCard(Zone.HAND, playerA, "Forgotten Cave");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertHandCount(playerA, "Swamp", 1);
}
@Test
public void testModifiedDraw() {
// If a draw is increased, the ability will apply additional times
addCard(Zone.LIBRARY, playerA, "Goblin Piker", 2);
addCard(Zone.LIBRARY, playerA, "Swamp", 10);
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Unpredictable Cyclone");
addCard(Zone.BATTLEFIELD, playerA, "Thought Reflection");
addCard(Zone.HAND, playerA, "Desert Cerodon");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
setChoice(playerA, "Thought Reflection"); // apply doubling first
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Goblin Piker", 2);
}
@Test
public void testModifiedDraw2() {
// Make sure the effect works with multiple stacked replacement effects
addCard(Zone.LIBRARY, playerA, "Goblin Piker", 4);
addCard(Zone.LIBRARY, playerA, "Swamp", 10);
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Unpredictable Cyclone");
addCard(Zone.BATTLEFIELD, playerA, "Thought Reflection", 2);
addCard(Zone.HAND, playerA, "Desert Cerodon");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
setChoice(playerA, "Thought Reflection", 3); // apply doubling first
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Goblin Piker", 4);
}
@Test
public void testStolenDraw() {
// if your opponent cycles a card and you steal that draw with Notion Thief, the draw will still be replaced
addCard(Zone.LIBRARY, playerA, "Goblin Piker", 1);
addCard(Zone.LIBRARY, playerA, "Swamp", 10);
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
addCard(Zone.BATTLEFIELD, playerA, "Unpredictable Cyclone");
addCard(Zone.HAND, playerB, "Desert Cerodon");
addCard(Zone.HAND, playerA, "Plagiarize");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Plagiarize", playerB);
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Cycling");
setStopAt(1, PhaseStep.END_TURN);
setStrictChooseMode(true);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Goblin Piker", 1);
}
}

View file

@ -2511,13 +2511,13 @@ public class TestPlayer implements Player {
}
@Override
public int drawCards(int num, Game game) {
return computerPlayer.drawCards(num, game);
public int drawCards(int num, UUID sourceId, Game game) {
return computerPlayer.drawCards(num, sourceId, game);
}
@Override
public int drawCards(int num, Game game, List<UUID> appliedEffects) {
return computerPlayer.drawCards(num, game, appliedEffects);
public int drawCards(int num, UUID sourceId, Game game, List<UUID> appliedEffects) {
return computerPlayer.drawCards(num, sourceId, game, appliedEffects);
}
@Override

View file

@ -528,12 +528,12 @@ public class PlayerStub implements Player {
}
@Override
public int drawCards(int num, Game game) {
public int drawCards(int num, UUID sourceId, Game game) {
return 0;
}
@Override
public int drawCards(int num, Game game, List<UUID> appliedEffects) {
public int drawCards(int num, UUID sourceId, Game game, List<UUID> appliedEffects) {
return 0;
}