create players, game and then createHandAndLibrary as creating hand and library using incTime from game

master
melvin 2011-07-05 10:54:20 +08:00
parent 2550c16d57
commit fbf3e10a4b
1 changed files with 19 additions and 5 deletions

View File

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