Update MapPanel.java
- sysouts
This commit is contained in:
parent
2a54eab4fc
commit
1319536671
1 changed files with 1 additions and 9 deletions
|
|
@ -170,30 +170,23 @@ public class MapPanel extends JScrollPane {
|
|||
if(scared.getOwner() == game.getCurrentPlayer()) {
|
||||
return;
|
||||
}
|
||||
System.out.println("Ausgewählt: " + scared.getName());
|
||||
List<Edge<Castle>> castleEdges = map.getEdges();
|
||||
List<Castle> adjacentCastles = new ArrayList<>();
|
||||
for(Edge<Castle> edge : castleEdges) {
|
||||
if(edge.getNodeA().getValue().equals(scared)) {
|
||||
if(edge.getNodeB().getValue().getOwner() != game.getCurrentPlayer() && !edge.getNodeB().getValue().equals(scared)) {
|
||||
adjacentCastles.add(edge.getNodeB().getValue());
|
||||
System.out.print("added: " + edge.getNodeB().getValue().getName());
|
||||
}
|
||||
} else if(edge.getNodeB().getValue().equals(scared)) {
|
||||
if(edge.getNodeA().getValue().getOwner() != game.getCurrentPlayer() && !edge.getNodeA().getValue().equals(scared)) {
|
||||
adjacentCastles.add(edge.getNodeA().getValue());
|
||||
System.out.print("added: " + edge.getNodeA().getValue().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int troopsToDistribute = scared.getTroopCount() - 1;
|
||||
System.out.println(troopsToDistribute);
|
||||
scared.removeTroops(troopsToDistribute);
|
||||
System.out.println(adjacentCastles.size());
|
||||
for(Castle c : adjacentCastles) {
|
||||
System.out.print(c.getName() + " ");
|
||||
}
|
||||
|
||||
|
||||
if(adjacentCastles.isEmpty()) {
|
||||
gameView.revalidate();
|
||||
|
|
@ -206,7 +199,6 @@ public class MapPanel extends JScrollPane {
|
|||
Random random = new Random();
|
||||
for(int i = 0; i < troopsToDistribute; i++) {
|
||||
int castleNumber = random.nextInt(adjacentCastles.size());
|
||||
System.out.print(castleNumber + " ");
|
||||
adjacentCastles.get(castleNumber).addTroops(1);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue