Add custom options for starting life total and starting hand size (#11259)

* add startHandSize / startLife to the custom option panel

* use the custom startLife/startHandsize in all Game Modes
This commit is contained in:
Susucre 2023-10-07 05:22:48 +02:00 committed by GitHub
parent 3e6097b70e
commit f14479c53c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 1230 additions and 929 deletions

View file

@ -34,7 +34,7 @@ public class GoadTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");
@ -65,8 +65,8 @@ public class GoadTest extends CardTestMultiPlayerBase {
/**
* Checks whether the given attacker is NOT goaded by the provided player(s).
*
* @param attacker the name of the attacker
* @param players the player(s) that the attacker is supposed to be goaded by.
* @param attacker the name of the attacker
* @param players the player(s) that the attacker is supposed to be goaded by.
*/
private void assertNotGoaded(String attacker, TestPlayer... players) {
Assert.assertTrue("At least one player should be provided", players.length > 0);
@ -87,8 +87,8 @@ public class GoadTest extends CardTestMultiPlayerBase {
/**
* Checks whether the given attacker is goaded by the provided player(s).
*
* @param attacker the name of the attacker
* @param players the player(s) that the attacker is supposed to be goaded by.
* @param attacker the name of the attacker
* @param players the player(s) that the attacker is supposed to be goaded by.
*/
private void assertGoaded(String attacker, TestPlayer... players) {
Assert.assertTrue("At least one player should be provided", players.length > 0);
@ -220,10 +220,10 @@ public class GoadTest extends CardTestMultiPlayerBase {
/**
* Reported bug: https://github.com/magefree/mage/issues/9227
* Geode Rager (and other goad all effects) goad creatures that enter the battlefield after the effect resolved.
*
* <p>
* Ruling:
* Creatures that enter the battlefield or come under the target players control after Geode Ragers ability has resolved wont be goaded.
* (2020-09-25)
* Creatures that enter the battlefield or come under the target players control after Geode Ragers ability has resolved wont be goaded.
* (2020-09-25)
*/
@Test
public void goadAllCorrectAffect() {

View file

@ -16,7 +16,7 @@ import java.io.FileNotFoundException;
public class NaturesWillTest extends CardTestPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");
playerC = createPlayer(game, "PlayerC");

View file

@ -16,7 +16,7 @@ import java.io.FileNotFoundException;
public class StormTheVaultTest extends CardTestPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");
playerC = createPlayer(game, "PlayerC");

View file

@ -23,7 +23,7 @@ public class BattleMultiplayerTest extends BattleBaseTest {
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(
MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL,
MulliganType.GAME_DEFAULT.getMulligan(0), 20
MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7
);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");

View file

@ -21,7 +21,7 @@ public class MonarchTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// reason: must use MultiplayerAttackOption.MULTIPLE
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -19,7 +19,7 @@ import java.io.FileNotFoundException;
public class RagsRichesTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -1,6 +1,5 @@
package org.mage.test.cards.single.c19;
import java.io.FileNotFoundException;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
@ -12,14 +11,15 @@ import mage.game.mulligan.MulliganType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
import java.io.FileNotFoundException;
/**
*
* @author azra1l <algee2005@gmail.com>
*/
public class AeonEngineTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException {
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");
@ -27,7 +27,7 @@ public class AeonEngineTest extends CardTestMultiPlayerBase {
playerD = createPlayer(game, "PlayerD");
return game;
}
@Test
public void testEnterTappedNormalTurnOrder() {
// Aeon Engine - Artefact - {5}
@ -47,7 +47,7 @@ public class AeonEngineTest extends CardTestMultiPlayerBase {
//check if aeon engine is tapped
assertTapped("Aeon Engine", true);
//check if turn was passed to correct player - should be D
assertActivePlayer(playerD);
assertLife(playerA, 17);
@ -82,7 +82,7 @@ public class AeonEngineTest extends CardTestMultiPlayerBase {
//check if aeon engine has been exiled
assertExileCount(playerA, "Aeon Engine", 1);
//check if turn was passed to correct player each turn - should be B
assertActivePlayer(playerB);
assertLife(playerA, 8);
@ -93,7 +93,7 @@ public class AeonEngineTest extends CardTestMultiPlayerBase {
assertGraveyardCount(playerC, "Agonizing Syphon", 1);
assertGraveyardCount(playerD, "Agonizing Syphon", 1);
}
@Test
public void testExileCostReversedTurnOrderDouble() throws GameException, FileNotFoundException {
// Aeon Engine - Artefact - {5}
@ -119,7 +119,7 @@ public class AeonEngineTest extends CardTestMultiPlayerBase {
castSpell(7, PhaseStep.PRECOMBAT_MAIN, playerC, "Agonizing Syphon", playerA);
activateAbility(8, PhaseStep.PRECOMBAT_MAIN, playerD, "{T}, Exile {this}:");
castSpell(9, PhaseStep.PRECOMBAT_MAIN, playerC, "Agonizing Syphon", playerA);
setStrictChooseMode(true);
setStopAt(9, PhaseStep.END_TURN);
execute();
@ -127,7 +127,7 @@ public class AeonEngineTest extends CardTestMultiPlayerBase {
//check if aeon engine's have been exiled
assertExileCount(playerA, "Aeon Engine", 1);
assertExileCount(playerD, "Aeon Engine", 1);
//check if turn was passed to correct player each turn - should be C
assertActivePlayer(playerC);
assertLife(playerA, 5);

View file

@ -19,7 +19,7 @@ public class PramikonSkyRampartTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -1,7 +1,5 @@
package org.mage.test.cards.single.hou;
import java.io.FileNotFoundException;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
@ -14,8 +12,9 @@ import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
import java.io.FileNotFoundException;
/**
*
* @author LevelX2
*/
public class TormentOfHailfireTest extends CardTestMultiPlayerBase {
@ -23,7 +22,7 @@ public class TormentOfHailfireTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");
@ -35,22 +34,22 @@ public class TormentOfHailfireTest extends CardTestMultiPlayerBase {
@Test
public void test_Normal() {
setStrictChooseMode(true);
// Repeat the following process X times. Each opponent loses 3 life unless they sacrifice a nonland permanent or discards a card.
addCard(Zone.HAND, playerA, "Torment of Hailfire", 1); // Sorcery {X}{B}{B}
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 12);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 2);
addCard(Zone.HAND, playerB, "Plains", 1);
addCard(Zone.BATTLEFIELD, playerC, "Silvercoat Lion", 3);
addCard(Zone.BATTLEFIELD, playerD, "Silvercoat Lion", 3);
addCard(Zone.BATTLEFIELD, playerD, "Silvercoat Lion", 3);
addCard(Zone.HAND, playerD, "Plains", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Torment of Hailfire");
setChoice(playerA, "X=10");
setChoice(playerD, true);// Sacrifices a nonland permanent?
setChoice(playerD, "Silvercoat Lion");
@ -65,22 +64,22 @@ public class TormentOfHailfireTest extends CardTestMultiPlayerBase {
setChoice(playerD, false);// Sacrifices a nonland permanent?
setChoice(playerD, true);// Discard a card?
setChoice(playerB, true);// Discard a card?
setChoice(playerD, true);// Sacrifices a nonland permanent?
setChoice(playerD, "Silvercoat Lion");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Torment of Hailfire", 1);
assertLife(playerA, 20);
assertLife(playerC, 20);
assertLife(playerD, 2);
assertLife(playerB, -1);
Assert.assertFalse("Player B is dead", playerB.isInGame());
}
}

View file

@ -16,13 +16,15 @@ public class FreeformUnlimitedCommanderTest extends MageTestPlayerBase {
// Arrange
Mulligan mulligan = new LondonMulligan(1);
int startLife = 40;
int startHandSize = 7;
// Assert
FreeformUnlimitedCommander game = new FreeformUnlimitedCommander(
MultiplayerAttackOption.MULTIPLE,
RangeOfInfluence.ALL,
mulligan,
startLife
startLife,
startHandSize
);
// Assert

View file

@ -1,10 +1,18 @@
package org.mage.test.mulligan;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Iterables.getOnlyElement;
import static java.util.Collections.unmodifiableList;
import static java.util.Collections.unmodifiableSet;
import mage.cards.CardSetInfo;
import mage.cards.basiclands.Forest;
import mage.cards.decks.Deck;
import mage.cards.s.Squire;
import static mage.constants.MultiplayerAttackOption.LEFT;
import mage.constants.RangeOfInfluence;
import static mage.constants.RangeOfInfluence.ONE;
import static mage.constants.Rarity.LAND;
import mage.game.Game;
import mage.game.GameOptions;
import mage.game.TwoPlayerDuel;
@ -12,6 +20,7 @@ import mage.game.mulligan.Mulligan;
import mage.game.mulligan.MulliganType;
import mage.players.StubPlayer;
import org.apache.log4j.Logger;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
@ -19,16 +28,6 @@ import java.util.Set;
import java.util.UUID;
import java.util.stream.Stream;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.Iterables.getOnlyElement;
import static java.util.Collections.unmodifiableList;
import static java.util.Collections.unmodifiableSet;
import static mage.constants.MultiplayerAttackOption.LEFT;
import static mage.constants.RangeOfInfluence.ONE;
import static mage.constants.Rarity.LAND;
import static org.junit.Assert.*;
public class MulliganTestBase {
protected static Logger logger = Logger.getLogger(MulliganTestBase.class);
@ -60,7 +59,7 @@ public class MulliganTestBase {
public void run(Runnable callback) {
Mulligan mulligan = mulliganType.getMulligan(freeMulligans);
Game game = new TwoPlayerDuel(LEFT, ONE, mulligan, 20) {
Game game = new TwoPlayerDuel(LEFT, ONE, mulligan, 60, 20, 7) {
@Override
public void fireStatusEvent(String message, boolean withTime, boolean withTurnInfo) {
super.fireStatusEvent(message, withTime, withTurnInfo);
@ -142,10 +141,10 @@ public class MulliganTestBase {
public static Deck generateDeck(UUID playerId, int count) {
Deck deck = new Deck();
Stream.generate(() -> new Forest(playerId, new CardSetInfo("Forest", "TEST", "1", LAND)))
.limit(count/2+(count & 1)) //If odd number of cards, add one extra forest
.limit(count / 2 + (count & 1)) //If odd number of cards, add one extra forest
.forEach(deck.getCards()::add);
Stream.generate(() -> new Squire(playerId, new CardSetInfo("Squire", "TEST", "2", LAND)))
.limit(count/2)
.limit(count / 2)
.forEach(deck.getCards()::add);
return deck;
}

View file

@ -18,7 +18,7 @@ public class AngelOfSerenityTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 2);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 2, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -20,7 +20,7 @@ public class BlatantThieveryTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -25,7 +25,7 @@ public class CreepingDreadTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -17,7 +17,7 @@ public class MultiplayerTriggerTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -20,7 +20,7 @@ public class MyriadTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -22,7 +22,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 3);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 3, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -9,7 +9,6 @@ import mage.game.FreeForAll;
import mage.game.Game;
import mage.game.GameException;
import mage.game.mulligan.MulliganType;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -24,7 +23,7 @@ public class PlayerLeftGameRange1Test extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 2);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 2, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -1,6 +1,5 @@
package org.mage.test.multiplayer;
import java.io.FileNotFoundException;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
@ -14,6 +13,8 @@ import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
import java.io.FileNotFoundException;
/**
* @author LevelX2
*/
@ -22,7 +23,7 @@ public class PlayerLeftGameRangeAllTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 2);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 2, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");
@ -419,14 +420,14 @@ public class PlayerLeftGameRangeAllTest extends CardTestMultiPlayerBase {
/**
* https://github.com/magefree/mage/issues/6997
Some continuous effects should stay in play even after the player that set them leaves the game.
Example:
* Player A: Casts Vorinclex, Voice of Hunger
* Player D: Taps all lands and do stuff (lands shouldn't untap during his next untap step)
* Player C: Kills Player A Player D: Lands untapped normally, though they shouldn't
*
* This happened playing commander against 3 AIs. One of the AIs played Vorinclex, I tapped all my lands during my turn to do stuff.
* Next AI killed the one that had Vorinclex. When the game got to my turn, my lands untapped normally.
* Some continuous effects should stay in play even after the player that set them leaves the game.
* Example:
* Player A: Casts Vorinclex, Voice of Hunger
* Player D: Taps all lands and do stuff (lands shouldn't untap during his next untap step)
* Player C: Kills Player A Player D: Lands untapped normally, though they shouldn't
* <p>
* This happened playing commander against 3 AIs. One of the AIs played Vorinclex, I tapped all my lands during my turn to do stuff.
* Next AI killed the one that had Vorinclex. When the game got to my turn, my lands untapped normally.
*/
@Test
public void TestContinuousEffectStaysAfterCreatingPlayerLeft() {
@ -456,20 +457,20 @@ public class PlayerLeftGameRangeAllTest extends CardTestMultiPlayerBase {
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerC, "Lightning Bolt", playerA);
setStopAt(5, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerD, "Silvercoat Lion", 1);
assertGraveyardCount(playerC, "Lightning Bolt", 1);
Assert.assertFalse("Player A is no longer in the game", playerA.isInGame());
Assert.assertTrue("Player D is the active player",currentGame.getActivePlayerId().equals(playerD.getId()));
Assert.assertTrue("Player D is the active player", currentGame.getActivePlayerId().equals(playerD.getId()));
assertTappedCount("Plains", true, 2); // Do not untap because of Vorinclex do not untap effect
}
}

View file

@ -1,6 +1,5 @@
package org.mage.test.multiplayer;
import java.io.FileNotFoundException;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
@ -13,6 +12,8 @@ import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
import java.io.FileNotFoundException;
/**
* @author LevelX2
@ -21,7 +22,7 @@ public class PlayerWinsTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");
@ -33,9 +34,9 @@ public class PlayerWinsTest extends CardTestMultiPlayerBase {
/**
* Tests multiplayer effects Player order: A -> D -> C -> B
*/
/**
* Test that players out of range do not lose the game if effect from Approach of the Seconnd Sun takes effect.
* Test that players out of range do not lose the game if effect from Approach of the Seconnd Sun takes effect.
*/
@Test
public void ApproachOfTheSecondSunTest() {
@ -59,20 +60,20 @@ public class PlayerWinsTest extends CardTestMultiPlayerBase {
Assert.assertTrue("Player A is in the game", playerA.isInGame());
}
/**
* Test that players out of range do not lose the game if effect from Laboratory Maniac takes effect.
* Test that players out of range do not lose the game if effect from Laboratory Maniac takes effect.
*/
@Test
public void LaboratoryManiacWinsTest() {
public void LaboratoryManiacWinsTest() {
// If you would draw a card while your library has no cards in it, you win the game instead.
addCard(Zone.HAND, playerA, "Laboratory Maniac", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
removeAllCardsFromLibrary(playerA);
addCard(Zone.LIBRARY, playerA, "Mountain");
setStopAt(5, PhaseStep.POSTCOMBAT_MAIN);
execute();
@ -84,25 +85,25 @@ public class PlayerWinsTest extends CardTestMultiPlayerBase {
Assert.assertTrue("Player C should be in the game but has lost", playerC.isInGame());
Assert.assertTrue("Player A should be in the game but has lost", playerA.isInGame());
}
/**
* Test that player can't win while Platinium Angel ist in range.
* Test that player can't win while Platinium Angel ist in range.
*/
@Test
public void LaboratoryManiacAndPlatinumAngelInRangeTest() {
public void LaboratoryManiacAndPlatinumAngelInRangeTest() {
// If you would draw a card while your library has no cards in it, you win the game instead.
addCard(Zone.HAND, playerA, "Laboratory Maniac", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
removeAllCardsFromLibrary(playerA);
// You can't lose the game and your opponents can't win the game.
addCard(Zone.HAND, playerD, "Platinum Angel", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerD, "Island", 7);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
addCard(Zone.LIBRARY, playerA, "Mountain");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerD, "Platinum Angel");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerD, "Platinum Angel");
setStopAt(9, PhaseStep.POSTCOMBAT_MAIN);
execute();
@ -110,33 +111,33 @@ public class PlayerWinsTest extends CardTestMultiPlayerBase {
assertPermanentCount(playerA, "Laboratory Maniac", 1);
assertHandCount(playerA, "Mountain", 1);
assertLibraryCount(playerA, 0);
assertPermanentCount(playerD, "Platinum Angel", 1);
Assert.assertTrue("Player D should be in the game but has lost", playerD.isInGame());
Assert.assertTrue("Player B should be in the game but has lost", playerB.isInGame());
Assert.assertTrue("Player C should be in the game but has lost", playerC.isInGame());
Assert.assertTrue("Player A should be in the game but has lost", playerA.isInGame());
}
/**
* Test that player can't win while Platinium Angel ist in range.
/**
* Test that player can't win while Platinium Angel ist in range.
*/
@Test
public void LaboratoryManiacAndPlatinumAngelFirstOutOfRangeTest() {
public void LaboratoryManiacAndPlatinumAngelFirstOutOfRangeTest() {
// If you would draw a card while your library has no cards in it, you win the game instead.
addCard(Zone.HAND, playerA, "Laboratory Maniac", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
removeAllCardsFromLibrary(playerA);
// You can't lose the game and your opponents can't win the game.
addCard(Zone.HAND, playerC, "Platinum Angel", 1); // Creature {2}{U}
addCard(Zone.BATTLEFIELD, playerC, "Island", 7);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laboratory Maniac");
addCard(Zone.LIBRARY, playerA, "Mountain");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerC, "Platinum Angel");
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerC, "Platinum Angel");
setStopAt(9, PhaseStep.POSTCOMBAT_MAIN);
execute();
@ -144,9 +145,9 @@ public class PlayerWinsTest extends CardTestMultiPlayerBase {
assertPermanentCount(playerA, "Laboratory Maniac", 1);
assertHandCount(playerA, "Mountain", 1);
assertLibraryCount(playerA, 0);
assertPermanentCount(playerC, "Platinum Angel", 1);
Assert.assertTrue("Player D still alive but should have lost the gamet", !playerD.isInGame());
Assert.assertTrue("Player B still alive but should have lost the game", !playerB.isInGame());
Assert.assertTrue("Player C should be in the game but has lost", playerC.isInGame());

View file

@ -22,7 +22,7 @@ public class PrivilegedPositionTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -20,7 +20,7 @@ public class VindictiveLichTest extends CardTestMultiPlayerBase {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -36,7 +36,7 @@ public class PlayGameTest extends MageTestBase {
@Ignore
@Test
public void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 60, 20, 7);
Player computerA = createPlayer("ComputerA", PlayerType.COMPUTER_MINIMAX_HYBRID);
// Player playerA = createPlayer("ComputerA", "Computer - mad");

View file

@ -24,7 +24,7 @@ public abstract class CardTestCommander3PlayersFFA extends CardTestPlayerAPIImpl
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new CommanderFreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new CommanderFreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
playerA = createPlayer(game, "PlayerA", deckNameA);
playerB = createPlayer(game, "PlayerB", deckNameB);
playerC = createPlayer(game, "PlayerC", deckNameC);

View file

@ -17,7 +17,7 @@ public abstract class CardTestCommander4Players extends CardTestPlayerAPIImpl {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new CommanderFreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new CommanderFreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -23,7 +23,7 @@ public abstract class CardTestCommanderDuelBase extends CardTestPlayerAPIImpl {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new CommanderDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 40);
Game game = new CommanderDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 40, 7);
playerA = createPlayer(game, "PlayerA", deckNameA);
playerB = createPlayer(game, "PlayerB", deckNameB);

View file

@ -21,7 +21,7 @@ public abstract class CardTestMultiPlayerBase extends CardTestPlayerAPIImpl {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -17,7 +17,7 @@ public abstract class CardTestMultiPlayerBaseWithRangeAll extends CardTestPlayer
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
// Player order: A -> D -> C -> B
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -1,6 +1,5 @@
package org.mage.test.serverside.base;
import java.io.FileNotFoundException;
import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence;
import mage.game.Game;
@ -9,6 +8,8 @@ import mage.game.OathbreakerFreeForAll;
import mage.game.mulligan.MulliganType;
import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
import java.io.FileNotFoundException;
/**
* @author LevelX2
*/
@ -23,7 +24,7 @@ public abstract class CardTestOathbreaker3PlayersFFA extends CardTestPlayerAPIIm
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new OathbreakerFreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new OathbreakerFreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
playerA = createPlayer(game, "PlayerA", deckNameA);
playerB = createPlayer(game, "PlayerB", deckNameB);
playerC = createPlayer(game, "PlayerC", deckNameC);

View file

@ -24,7 +24,7 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 60, 20, 7);
playerA = createPlayer(game, "PlayerA", deckNameA);
playerB = createPlayer(game, "PlayerB", deckNameB);

View file

@ -14,7 +14,7 @@ import java.io.FileNotFoundException;
/**
* PlayerA is full AI player and process all actions as AI logic. You don't need aiXXX commands in that tests.
*
* <p>
* If you need custom AI tests then use CardTestPlayerBaseWithAIHelps with aiXXX commands
*
* @author LevelX2
@ -25,7 +25,7 @@ public abstract class CardTestPlayerBaseAI extends CardTestPlayerAPIImpl {
@Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, MulliganType.GAME_DEFAULT.getMulligan(0), 60, 20, 7);
playerA = createPlayer(game, "PlayerA");
playerB = createPlayer(game, "PlayerB");

View file

@ -94,7 +94,7 @@ public class RandomTest {
String dest = "f:/test/xmage/";
//RandomUtil.setSeed(123);
Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 50);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 60, 50, 7);
int height = 512;
int weight = 512;
@ -117,7 +117,7 @@ public class RandomTest {
String dest = "f:/test/xmage/";
//RandomUtil.setSeed(123);
Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 50);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 60, 50, 7);
int height = 512;
int weight = 512;
@ -142,7 +142,7 @@ public class RandomTest {
String dest = "f:/test/xmage/";
//RandomUtil.setSeed(123);
Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 50);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 60, 50, 7);
Deck deck = DeckTestUtils.buildRandomDeck("WGUBR", false, "GRN");
player.getLibrary().addAll(deck.getMaindeckCards(), game);