From 4cea4b371592ec6b1580ec92c8902eb7622bacec Mon Sep 17 00:00:00 2001 From: Dennis Weinberger Date: Tue, 26 Mar 2019 17:45:38 +0000 Subject: [PATCH] Update BasicAI.java - Jokers --- .../src/game/players/BasicAI.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Projektgruppe_175/src/game/players/BasicAI.java b/Projektgruppe_175/src/game/players/BasicAI.java index de989c7..918bb12 100644 --- a/Projektgruppe_175/src/game/players/BasicAI.java +++ b/Projektgruppe_175/src/game/players/BasicAI.java @@ -13,6 +13,8 @@ import game.Game; import game.map.Castle; import gui.AttackThread; +import gui.components.JokerPanel.JokerTypes; + public class BasicAI extends AI { public BasicAI(String name, Color color) { @@ -43,6 +45,24 @@ public class BasicAI extends AI { } } 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 Graph graph = game.getMap().getGraph(); List castleNearEnemy = new ArrayList<>();