create players, game and then createHandAndLibrary as creating hand and library using incTime from game
parent
2550c16d57
commit
fbf3e10a4b
|
@ -171,12 +171,26 @@ public class MagicTournament {
|
|||
}
|
||||
|
||||
public MagicGame nextGame(final boolean sound) {
|
||||
//create players
|
||||
final MagicPlayer player = new MagicPlayer(configuration,playerDefinitions[0],0);
|
||||
final MagicPlayer opponent = new MagicPlayer(configuration,playerDefinitions[opponentIndex],1);
|
||||
|
||||
final MagicPlayer player=new MagicPlayer(configuration,playerDefinitions[0],0);
|
||||
final MagicPlayer opponent=new MagicPlayer(configuration,playerDefinitions[opponentIndex],1);
|
||||
final MagicPlayer start=startPlayer==0?player:opponent;
|
||||
return new MagicGame(this,MagicDefaultGameplay.getInstance(),new MagicPlayer[]{player,opponent},start,sound);
|
||||
}
|
||||
//determine who starts first
|
||||
final MagicPlayer start = startPlayer == 0 ? player : opponent;
|
||||
|
||||
//create game
|
||||
final MagicGame game = new MagicGame(
|
||||
this,
|
||||
MagicDefaultGameplay.getInstance(),
|
||||
new MagicPlayer[]{player,opponent},
|
||||
start,
|
||||
sound);
|
||||
|
||||
//create hand and library
|
||||
player.createHandAndLibrary(configuration.getHandSize());
|
||||
opponent.createHandAndLibrary(configuration.getHandSize());
|
||||
return game;
|
||||
}
|
||||
|
||||
public int getNrOfPlayers() {
|
||||
return playerDefinitions.length;
|
||||
|
|
Loading…
Reference in New Issue