mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
refactor: expose startingHandSize in GameImpl constructor. (#10629)
For now, it is 7 in every game mode.
This commit is contained in:
parent
b607efba4f
commit
6b616dbf20
9 changed files with 20 additions and 13 deletions
|
|
@ -752,7 +752,7 @@ class TestGame extends GameImpl {
|
||||||
private int numPlayers;
|
private int numPlayers;
|
||||||
|
|
||||||
public TestGame(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
public TestGame(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||||
super(attackOption, range, mulligan, startLife, 60);
|
super(attackOption, range, mulligan, startLife, 60, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestGame(final TestGame game) {
|
public TestGame(final TestGame game) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public class FreeForAll extends GameImpl {
|
||||||
private int numPlayers;
|
private int numPlayers;
|
||||||
|
|
||||||
public FreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
public FreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||||
super(attackOption, range, mulligan, startLife, 60);
|
super(attackOption, range, mulligan, startLife, 60, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FreeForAll(final FreeForAll game) {
|
public FreeForAll(final FreeForAll game) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.common.InfoEffect;
|
import mage.abilities.effects.common.InfoEffect;
|
||||||
|
|
@ -17,6 +16,8 @@ import mage.game.mulligan.Mulligan;
|
||||||
import mage.game.turn.TurnMod;
|
import mage.game.turn.TurnMod;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author nigelzor
|
* @author nigelzor
|
||||||
|
|
@ -24,7 +25,7 @@ import mage.players.Player;
|
||||||
public class MomirDuel extends GameImpl {
|
public class MomirDuel extends GameImpl {
|
||||||
|
|
||||||
public MomirDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
public MomirDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||||
super(attackOption, range, mulligan, startLife, 60);
|
super(attackOption, range, mulligan, startLife, 60, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MomirDuel(final MomirDuel game) {
|
public MomirDuel(final MomirDuel game) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.common.InfoEffect;
|
import mage.abilities.effects.common.InfoEffect;
|
||||||
|
|
@ -17,6 +16,8 @@ import mage.game.mulligan.Mulligan;
|
||||||
import mage.game.turn.TurnMod;
|
import mage.game.turn.TurnMod;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author nigelzor
|
* @author nigelzor
|
||||||
|
|
@ -26,7 +27,7 @@ public class MomirGame extends GameImpl {
|
||||||
private int numPlayers;
|
private int numPlayers;
|
||||||
|
|
||||||
public MomirGame(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
public MomirGame(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||||
super(attackOption, range, mulligan, startLife, 60);
|
super(attackOption, range, mulligan, startLife, 60, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MomirGame(final MomirGame game) {
|
public MomirGame(final MomirGame game) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,11 @@ public class TwoPlayerDuel extends GameImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
|
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
|
||||||
super(attackOption, range, mulligan, startingLife, minimumDeckSize);
|
this(attackOption, range, mulligan, startingLife, minimumDeckSize, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize, int startingHandSize) {
|
||||||
|
super(attackOption, range, mulligan, startingLife, minimumDeckSize, startingHandSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TwoPlayerDuel(final TwoPlayerDuel game) {
|
public TwoPlayerDuel(final TwoPlayerDuel game) {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import java.util.UUID;
|
||||||
public abstract class GameCanadianHighlanderImpl extends GameImpl {
|
public abstract class GameCanadianHighlanderImpl extends GameImpl {
|
||||||
|
|
||||||
public GameCanadianHighlanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
public GameCanadianHighlanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||||
super(attackOption, range, mulligan, startLife, 100);
|
super(attackOption, range, mulligan, startLife, 100, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameCanadianHighlanderImpl(final GameCanadianHighlanderImpl game) {
|
public GameCanadianHighlanderImpl(final GameCanadianHighlanderImpl game) {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public abstract class GameCommanderImpl extends GameImpl {
|
||||||
protected boolean startingPlayerSkipsDraw = true;
|
protected boolean startingPlayerSkipsDraw = true;
|
||||||
|
|
||||||
public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
|
public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
|
||||||
super(attackOption, range, mulligan, startingLife, minimumDeckSize);
|
super(attackOption, range, mulligan, startingLife, minimumDeckSize, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameCommanderImpl(final GameCommanderImpl game) {
|
public GameCommanderImpl(final GameCommanderImpl game) {
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,7 @@ public abstract class GameImpl implements Game {
|
||||||
private boolean saveGame = false; // replay code, not done
|
private boolean saveGame = false; // replay code, not done
|
||||||
private int priorityTime; // match time limit
|
private int priorityTime; // match time limit
|
||||||
private final int startingLife;
|
private final int startingLife;
|
||||||
|
private final int startingHandSize;
|
||||||
private final int minimumDeckSize;
|
private final int minimumDeckSize;
|
||||||
protected transient PlayerList playerList; // auto-generated from state, don't copy
|
protected transient PlayerList playerList; // auto-generated from state, don't copy
|
||||||
|
|
||||||
|
|
@ -156,13 +157,14 @@ public abstract class GameImpl implements Game {
|
||||||
// temporary store for income concede commands, don't copy
|
// temporary store for income concede commands, don't copy
|
||||||
private final LinkedList<UUID> concedingPlayers = new LinkedList<>();
|
private final LinkedList<UUID> concedingPlayers = new LinkedList<>();
|
||||||
|
|
||||||
public GameImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize) {
|
public GameImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startingLife, int minimumDeckSize, int startingHandSize) {
|
||||||
this.id = UUID.randomUUID();
|
this.id = UUID.randomUUID();
|
||||||
this.range = range;
|
this.range = range;
|
||||||
this.mulligan = mulligan;
|
this.mulligan = mulligan;
|
||||||
this.attackOption = attackOption;
|
this.attackOption = attackOption;
|
||||||
this.state = new GameState();
|
this.state = new GameState();
|
||||||
this.startingLife = startingLife;
|
this.startingLife = startingLife;
|
||||||
|
this.startingHandSize = startingHandSize;
|
||||||
this.executingRollback = false;
|
this.executingRollback = false;
|
||||||
this.minimumDeckSize = minimumDeckSize;
|
this.minimumDeckSize = minimumDeckSize;
|
||||||
|
|
||||||
|
|
@ -251,6 +253,7 @@ public abstract class GameImpl implements Game {
|
||||||
this.saveGame = game.saveGame;
|
this.saveGame = game.saveGame;
|
||||||
this.priorityTime = game.priorityTime;
|
this.priorityTime = game.priorityTime;
|
||||||
this.startingLife = game.startingLife;
|
this.startingLife = game.startingLife;
|
||||||
|
this.startingHandSize = game.startingHandSize;
|
||||||
this.minimumDeckSize = game.minimumDeckSize;
|
this.minimumDeckSize = game.minimumDeckSize;
|
||||||
//this.playerList = game.playerList; // auto-generated list, don't copy
|
//this.playerList = game.playerList; // auto-generated list, don't copy
|
||||||
|
|
||||||
|
|
@ -1253,7 +1256,6 @@ public abstract class GameImpl implements Game {
|
||||||
sendStartMessage(choosingPlayer, startingPlayer);
|
sendStartMessage(choosingPlayer, startingPlayer);
|
||||||
|
|
||||||
//20091005 - 103.3
|
//20091005 - 103.3
|
||||||
int startingHandSize = 7;
|
|
||||||
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
||||||
Player player = getPlayer(playerId);
|
Player player = getPlayer(playerId);
|
||||||
if (!gameOptions.testMode || player.getLife() == 0) {
|
if (!gameOptions.testMode || player.getLife() == 0) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import mage.game.turn.TurnMod;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
import mage.watchers.common.CommanderInfoWatcher;
|
import mage.watchers.common.CommanderInfoWatcher;
|
||||||
import mage.watchers.common.CommanderPlaysCountWatcher;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -33,7 +32,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
|
||||||
protected boolean startingPlayerSkipsDraw = true;
|
protected boolean startingPlayerSkipsDraw = true;
|
||||||
|
|
||||||
public GameTinyLeadersImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
public GameTinyLeadersImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||||
super(attackOption, range, mulligan, startLife, 50);
|
super(attackOption, range, mulligan, startLife, 50, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameTinyLeadersImpl(final GameTinyLeadersImpl game) {
|
public GameTinyLeadersImpl(final GameTinyLeadersImpl game) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue