Merge branch 'master' into implement-zilortha

# Conflicts:
#	Mage/src/main/java/mage/game/GameImpl.java
This commit is contained in:
htrajan 2020-04-16 15:55:24 -07:00
commit a08bd34582
332 changed files with 1928 additions and 589 deletions

View file

@ -0,0 +1,114 @@
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);
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);
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);
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);
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);
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

@ -3,7 +3,11 @@ package org.mage.test.serverside.performance;
import mage.abilities.keyword.InfectAbility;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.mulligan.LondonMulligan;
import mage.game.permanent.PermanentCard;
import mage.game.permanent.PermanentImpl;
import mage.remote.traffic.ZippedObjectImpl;
@ -50,4 +54,25 @@ public class SerializationTest extends CardTestPlayerBase {
Assert.assertEquals("Must get infected counter", 1, permanent.getCounters(currentGame).getCount(CounterType.M1M1));
}
@Test
public void test_LondonMulligan() {
LondonMulligan mulligan = new LondonMulligan(15);
Object compressed = CompressUtil.compress(mulligan);
Assert.assertTrue("Must be zip", compressed instanceof ZippedObjectImpl);
LondonMulligan uncompressed = (LondonMulligan) CompressUtil.decompress(compressed);
Assert.assertEquals("Must be same", mulligan.getFreeMulligans(), uncompressed.getFreeMulligans());
}
@Test
public void test_Game() {
addCard(Zone.BATTLEFIELD, playerA, "Grizzly Bears", 1);
setStopAt(1, PhaseStep.END_TURN);
execute();
Object compressed = CompressUtil.compress(currentGame);
Assert.assertTrue("Must be zip", compressed instanceof ZippedObjectImpl);
Game uncompressed = (Game) CompressUtil.decompress(compressed);
Assert.assertEquals("Must be same", 1, uncompressed.getBattlefield().getAllActivePermanents().size());
}
}

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;
}