Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
be26fc77cd
|
@ -6,6 +6,9 @@ import org.beryx.textio.TextTerminal;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static ch.zhaw.catan.Command.*;
|
||||
import static ch.zhaw.catan.Command.QUIT;
|
||||
|
||||
public class Siedler {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -14,11 +17,29 @@ public class Siedler {
|
|||
Parser parser = new Parser();
|
||||
SiedlerGame game = foundingPhase(parser);
|
||||
|
||||
parser.getAction();
|
||||
|
||||
|
||||
//Spielfeld ausgeben
|
||||
|
||||
boolean running = true;
|
||||
while (running){
|
||||
parser.playerTurn(game.getCurrentPlayerFaction());
|
||||
switch (parser.getAction()) {
|
||||
case NEXTPLAYER:
|
||||
game.switchToNextPlayer();
|
||||
break;
|
||||
case BUILDSETTLEMENT:
|
||||
game.
|
||||
break;
|
||||
case BUILDCITY:
|
||||
break;
|
||||
case BUILDROAD:
|
||||
break;
|
||||
case TRADEWITHBANK:
|
||||
break;
|
||||
case QUIT:
|
||||
running = false;
|
||||
break;
|
||||
default:
|
||||
parser.errorMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -32,12 +53,14 @@ public class Siedler {
|
|||
private static SiedlerGame foundingPhase(Parser parser) {
|
||||
HashMap<String, Integer> gameInfo = parser.gameStart();
|
||||
SiedlerGame game = new SiedlerGame(gameInfo.get("NumberOfWinPoints"), gameInfo.get("NumberOfPlayers"));
|
||||
|
||||
for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){
|
||||
buildStructuresInFoundingPhase(game, parser, false);
|
||||
if(player < gameInfo.get("NumberOfPlayers")){
|
||||
game.switchToPreviousPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){
|
||||
buildStructuresInFoundingPhase(game, parser, true);
|
||||
game.switchToNextPlayer();
|
||||
|
|
|
@ -58,10 +58,10 @@ public class SiedlerGame {
|
|||
* Switches to the next player in the defined sequence of players.
|
||||
*/
|
||||
public void switchToNextPlayer() {
|
||||
if (activePlayer < allPlayers.size()){
|
||||
if (activePlayer < allPlayers.size() -1){
|
||||
activePlayer++;
|
||||
}
|
||||
else if (activePlayer == allPlayers.size()){
|
||||
else if (activePlayer == allPlayers.size() -1){
|
||||
activePlayer = 0;
|
||||
}
|
||||
}
|
||||
|
@ -220,11 +220,6 @@ public class SiedlerGame {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean buildSettlementFoundation(Point position) {
|
||||
//todo implement
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a city at the specified position on the board.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue