Added placeInitialRoad and placeInitialSettlement methods.

This commit is contained in:
Speedy Gonzalez 2021-12-03 11:28:42 +01:00
parent 442cce6761
commit 2dfe55584e
1 changed files with 12 additions and 0 deletions

View File

@ -148,6 +148,14 @@ public class SiedlerGame {
*/
public boolean placeInitialSettlement(Point position, boolean payout) {
// TODO: Implement
if(!validPositionForSettlement(position)){
return false;
}
board.setCorner(position, new Settlement(allPlayers.get(activePlayer).getFaction()));
List<Config.Land> lands = board.getLandsForCorner(position);
for (Config.Land land:lands){
allPlayers.get(activePlayer).addResource(land.getResource(), 1);
}
return true;
}
@ -161,6 +169,10 @@ public class SiedlerGame {
*/
public boolean placeInitialRoad(Point roadStart, Point roadEnd) {
// TODO: Implement
if (!validPositionForRoad(roadStart, roadEnd)){
return false;
}
board.setEdge(roadStart, roadEnd, new Road(allPlayers.get(activePlayer).getFaction()));
return true;
}