Added placeInitialRoad and placeInitialSettlement methods.
This commit is contained in:
parent
442cce6761
commit
2dfe55584e
|
@ -148,6 +148,14 @@ public class SiedlerGame {
|
||||||
*/
|
*/
|
||||||
public boolean placeInitialSettlement(Point position, boolean payout) {
|
public boolean placeInitialSettlement(Point position, boolean payout) {
|
||||||
// TODO: Implement
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,6 +169,10 @@ public class SiedlerGame {
|
||||||
*/
|
*/
|
||||||
public boolean placeInitialRoad(Point roadStart, Point roadEnd) {
|
public boolean placeInitialRoad(Point roadStart, Point roadEnd) {
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
|
if (!validPositionForRoad(roadStart, roadEnd)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
board.setEdge(roadStart, roadEnd, new Road(allPlayers.get(activePlayer).getFaction()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue