Update BasicAI.java - Jokers
This commit is contained in:
parent
6e4247230f
commit
4cea4b3715
1 changed files with 20 additions and 0 deletions
|
|
@ -13,6 +13,8 @@ import game.Game;
|
||||||
import game.map.Castle;
|
import game.map.Castle;
|
||||||
import gui.AttackThread;
|
import gui.AttackThread;
|
||||||
|
|
||||||
|
import gui.components.JokerPanel.JokerTypes;
|
||||||
|
|
||||||
public class BasicAI extends AI {
|
public class BasicAI extends AI {
|
||||||
|
|
||||||
public BasicAI(String name, Color color) {
|
public BasicAI(String name, Color color) {
|
||||||
|
|
@ -43,6 +45,24 @@ public class BasicAI extends AI {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// JOKER
|
||||||
|
if(getJokers()[0] == JokerTypes.ADD_TROOPS) {
|
||||||
|
playTroopsJoker();
|
||||||
|
}
|
||||||
|
|
||||||
|
// SCARE-JOKER
|
||||||
|
if(getJokers()[1] == JokerTypes.SCARE_TROOPS) {
|
||||||
|
for(Castle c : game.getMap().getCastles()) {
|
||||||
|
System.out.print(c.getName() + " " + c.getTroopCount() + " " + c.getOwner().getName());
|
||||||
|
if(c.getOwner() != game.getCurrentPlayer() && c.getTroopCount() > 1) {
|
||||||
|
playScareJoker(c, game);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 1. Distribute remaining troops
|
// 1. Distribute remaining troops
|
||||||
Graph<Castle> graph = game.getMap().getGraph();
|
Graph<Castle> graph = game.getMap().getGraph();
|
||||||
List<Castle> castleNearEnemy = new ArrayList<>();
|
List<Castle> castleNearEnemy = new ArrayList<>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue