diff --git a/src/main/java/org/monster/board/StrategyBoard.java b/src/main/java/org/monster/board/StrategyBoard.java
index de1f76d..d30cfbf 100644
--- a/src/main/java/org/monster/board/StrategyBoard.java
+++ b/src/main/java/org/monster/board/StrategyBoard.java
@@ -20,7 +20,7 @@
public class StrategyBoard {
- private static StrategyBoard instance = new StrategyBoard();
+ public static StrategyBoard instance = new StrategyBoard();
public static StrategyBoard Instance() {
return instance;
diff --git a/src/main/java/org/monster/bootstrap/GameCommander.java b/src/main/java/org/monster/bootstrap/GameCommander.java
index 87694f9..8604f34 100644
--- a/src/main/java/org/monster/bootstrap/GameCommander.java
+++ b/src/main/java/org/monster/bootstrap/GameCommander.java
@@ -5,6 +5,9 @@
import bwapi.Position;
import bwapi.TilePosition;
import bwapi.Unit;
+
+import java.lang.reflect.Field;
+
import org.monster.board.StrategyBoard;
import org.monster.build.base.BuildManager;
import org.monster.build.base.ConstructionManager;
diff --git a/src/main/java/org/monster/debugger/PreBotUXManager.java b/src/main/java/org/monster/debugger/PreBotUXManager.java
index ff2262a..fecb1d3 100644
--- a/src/main/java/org/monster/debugger/PreBotUXManager.java
+++ b/src/main/java/org/monster/debugger/PreBotUXManager.java
@@ -1,21 +1,16 @@
package org.monster.debugger;
-import bwapi.Bullet;
-import bwapi.BulletType;
-import bwapi.Color;
-import bwapi.Force;
-import bwapi.Game;
-import bwapi.Player;
-import bwapi.Position;
-import bwapi.Race;
-import bwapi.TilePosition;
-import bwapi.Unit;
-import bwapi.UnitType;
-import bwta.BWTA;
-import bwta.BaseLocation;
-import bwta.Chokepoint;
-import bwta.Polygon;
-import bwta.Region;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
import org.monster.board.StrategyBoard;
import org.monster.bootstrap.GameManager;
import org.monster.build.base.BuildManager;
@@ -30,19 +25,16 @@
import org.monster.common.UnitInfo;
import org.monster.common.constant.CommonCode;
import org.monster.common.constant.EnemyUnitVisibleStatus;
-import org.monster.common.constant.UnitFindStatus;
import org.monster.common.util.BaseUtils;
import org.monster.common.util.ChokeUtils;
import org.monster.common.util.DrawingUtils;
import org.monster.common.util.PlayerUtils;
-import org.monster.common.util.PositionUtils;
import org.monster.common.util.TimeUtils;
import org.monster.common.util.UnitTypeUtils;
import org.monster.common.util.UnitUtils;
+import org.monster.debugger.chat.impl.UxDrawConfig;
import org.monster.micro.CombatManager;
import org.monster.micro.MicroDecision;
-import org.monster.strategy.manage.EnemyStrategyAnalyzer;
-import org.monster.worker.Minerals;
import org.monster.micro.squad.Squad;
import org.monster.micro.squad.WatcherSquad;
import org.monster.strategy.StrategyManager;
@@ -52,1598 +44,1379 @@
import org.monster.strategy.manage.AirForceTeam;
import org.monster.strategy.manage.ClueManager;
import org.monster.strategy.manage.EnemyBuildTimer;
+import org.monster.strategy.manage.EnemyStrategyAnalyzer;
+import org.monster.worker.Minerals;
import org.monster.worker.WorkerData;
import org.monster.worker.WorkerManager;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
+import bwapi.Bullet;
+import bwapi.BulletType;
+import bwapi.Color;
+import bwapi.Force;
+import bwapi.Game;
+import bwapi.Player;
+import bwapi.Position;
+import bwapi.Race;
+import bwapi.TilePosition;
+import bwapi.Unit;
+import bwapi.UnitType;
+import bwta.BWTA;
+import bwta.BaseLocation;
+import bwta.Chokepoint;
+import bwta.Polygon;
+import bwta.Region;
/// 봇 프로그램 개발의 편의성 향상을 위해 게임 화면에 추가 정보들을 표시하는 class
/// 여러 Manager 들로부터 정보를 조회하여 Screen 혹은 Map 에 정보를 표시합니다
public class PreBotUXManager {
- private static PreBotUXManager instance = new PreBotUXManager();
- private final int dotRadius = 2;
- public Unit leader = null;
- private int uxOption = 0;
- private boolean hasSavedBWTAInfo = false;
- private int[][] blue = null;
- private int[][] cyan = null;
- private int[][] orange = null;
- private int[][] purple = null;
- private List yellow = new ArrayList();
- private List green1 = new ArrayList();
- private List green2 = new ArrayList();
- private List red1 = new ArrayList();
- private List red2 = new ArrayList();
- private String bulletTypeName = "";
- private String tempUnitName = "";
-
- private UnitType factorySelected = UnitType.None;
-
- private Map decisionListForUx = new HashMap<>();
-
- /// static singleton 객체를 리턴합니다
- public static PreBotUXManager Instance() {
- return instance;
- }
-
- public void setUxOption(int uxOption) {
- this.uxOption = uxOption;
- }
-
- private Game Broodwar;
- /// 경기가 시작될 때 일회적으로 추가 정보를 출력합니다
- public void onStart(Game Broodwar) {
- this.Broodwar = Broodwar;
- }
-
- /// 경기 진행 중 매 프레임마다 추가 정보를 출력하고 사용자 입력을 처리합니다
- public void update() {
- if (uxOption == 0) {
- UXManager.Instance().update();
-// drawDebugginUxMenu();
- } else {
-
- if (uxOption == 1) {
- drawGameInformationOnScreen(5, 5);
- drawBWTAResultOnMap();
- drawBuildOrderQueueOnScreen(500, 50);
- drawBuildStatusOnScreen(370, 50);
- drawConstructionQueueOnScreenAndMap(200, 150);
- drawReservedBuildingTilesOnMap();
- drawTilesToAvoidOnMap();
- drawWorkerMiningStatusOnMap();
- drawUnitTargetOnMap();
- drawnextPoints();
- drawTurretMap();
- drawManagerTimeSpent(490, 200);
-
- // draw tile position of mouse cursor
- int mouseX = Broodwar.getMousePosition().getX() + Broodwar.getScreenPosition().getX();
- int mouseY = Broodwar.getMousePosition().getY() + Broodwar.getScreenPosition().getY();
- Broodwar.drawTextMap(mouseX + 20, mouseY,
- "(" + (int) (mouseX / 32) + ", " + (int) (mouseY / 32) + ")");
- Broodwar.drawTextMap(mouseX + 20, mouseY + 10, "(" + (int) (mouseX) + ", " + (int) (mouseY) + ")");
- // 미네랄PATH
- } else if (uxOption == 2) {
- drawStrategy();
-
- } else if (uxOption == 3) {
- drawEnemyBuildTimer();
- // drawCCtoScvCount();
- } else if (uxOption == 4) {
- drawSquadInfoOnMap(20, 30);
- drawManagerTimeSpent(490, 200);
- drawDecision();
- drawEnemyAirDefenseRange();
- drawAirForceInformation();
- drawVulturePolicy();
-
- } else if (uxOption == 5) {
- drawEnemyBaseToBaseTime();
-
- } else if (uxOption == 6) {
- drawBigWatch();
- drawManagerTimeSpent(490, 200);
- } else if (uxOption == 7) {
- drawTurretMap();
- drawTilesToAvoidOnMap();
- drawReservedBuildingTilesOnMap();
- } else if (uxOption == 8) {
-// drawExpectedResource();
- //drawExpectedResource2();
- }
-
- drawMineralIdOnMap();
- drawUnitIdOnMap();
- drawPositionInformation();
- drawTimer();
- drawPathData();
- drawSquadUnitTagMap();
- }
-
- clearDecisionListForUx();
-
-// if (TimeUtils.executeRotation(1, 11)) {
-//// System.out.println("execute debugBuildLocationSet");
-// ConstructionPlaceFinder.Instance().debugBuildLocationSet();
-// }
-//
-// if (TimeUtils.executeRotation(1, 233)) {
-//// System.out.println("execute debugBuildLocationPrint");
-// ConstructionPlaceFinder.Instance().debugBuildLocationPrint();
-// }
- }
-
-
-// private void drawExpectedResource2() {
-// int m = 190;
-// //Broodwar.drawTextScreen(190, 10, "EnemyPredictedUnitLIst: " + AttackDecisionMaker.Instance().predictedTotalEnemyAttackUnit.size());
-// System.out.println("EnemyPredictedUnitLIst: " + AttackDecisionMaker.Instance().predictedTotalEnemyAttackUnit.size());
-// int l = 10;
-// for (Entry enenmy : AttackDecisionMaker.Instance().predictedTotalEnemyAttackUnit.entrySet()) {
-// float cnt = enenmy.getValue().get();
-// UnitType unitType = enenmy.getKey();
-// System.out.println(unitType.toString().substring(7, 14) + " : " + cnt);
-// //Broodwar.drawTextScreen(m, l+=10, unitType.toString().substring(7, 14)+" : "+cnt);
-// }
-// }
-//
-// private void drawExpectedResource() {
-// Map enemyCommandInfoMap = AttackDecisionMaker.Instance().enemyResourceDepotInfoMap;
-//
-// int y = 0;
-// Broodwar.drawTextScreen(10, y += 10, "this mymineral : " + Broodwar.self().gatheredMinerals());
-// Broodwar.drawTextScreen(10, y += 10, "total enemy cnt : " + enemyCommandInfoMap.size());
-// Broodwar.drawTextScreen(10, y += 10, "mygas : " + Broodwar.self().gatheredGas());
-// Broodwar.drawTextScreen(10, y += 10, "mywrkcnt(real) : " + UnitUtils.getCompletedUnitCount(UnitType.Terran_SCV));
-// Broodwar.drawTextScreen(10, y += 10, "frame ==== " + TimeUtils.getFrame());
-//
-// y = drawCalculation(10, y);
-//
-//
-// y += 10;
-// if (enemyCommandInfoMap.size() == 0) {
-// Broodwar.drawTextScreen(10, y += 10, "No enemy base info");
-// } else {
-//
-// int k = 1;
-// int x = 10;
-// int temp = y;
-// for (Map.Entry entry : enemyCommandInfoMap.entrySet()) {
-// y = temp;
-// UnitInfo unitInfo = entry.getKey();
-// EnemyCommandInfo enemyCommandInfo = entry.getValue();
-//
-// if (AttackDecisionMaker.Instance().skipResourceDepot.size() == 0) {
-// Broodwar.drawTextScreen(10, y += 10, "skipped base : no skipped base");
-// } else {
-// for (UnitInfo skip : AttackDecisionMaker.Instance().skipResourceDepot) {
-// Broodwar.drawTextScreen(10, y += 10, "skipped base : " + skip.getLastPosition());
-// }
-// }
-//
-// Broodwar.drawTextScreen(x, y += 10, k++ + " base" + unitInfo.getLastPosition() + ", " + enemyCommandInfo.mineralCalculator.getMineralCount());
-// Broodwar.drawTextScreen(x, y += 10, "isMainBase : " + enemyCommandInfo.isMainBase);
-// Broodwar.drawTextScreen(x, y += 10, "has gas : " + enemyCommandInfo.gasCalculator.hasGasBuilding());
-// Broodwar.drawTextScreen(x, y += 10, "mineral(real) : " + ((int) enemyCommandInfo.mineralCalculator.getFullCheckMineral() + (int) 50));
-// Broodwar.drawTextScreen(x, y += 10, "mineral(r+p): : " + ((int) enemyCommandInfo.uxmineral + (int) 50));
-// Broodwar.drawTextScreen(x, y += 10, "gas(real) : " + enemyCommandInfo.gasCalculator.getRealGas());
-// Broodwar.drawTextScreen(x, y += 10, "gas(r+p) : " + enemyCommandInfo.gasCalculator.getGas());
-// Broodwar.drawTextScreen(x, y += 10, "fullWorkerFrame : " + enemyCommandInfo.fullWorkerFrame);
-// Broodwar.drawTextScreen(x, y += 10, "halfWorkerFrame : " + enemyCommandInfo.halfWorkerFrame);
-// Broodwar.drawTextScreen(x, y += 10, "wrkcnt(real) : " + enemyCommandInfo.workerCounter.realWorkerCount);
-// Broodwar.drawTextScreen(x, y += 10, "wrkcnt(r+p) : " + ((int) enemyCommandInfo.workerCounter.getWorkerCount(enemyCommandInfo.lastFullCheckFrame)));
-// Broodwar.drawTextScreen(x, y += 10, "fwrkcnt : " + ((int) enemyCommandInfo.lastFullCheckWorkerCount));
-// Broodwar.drawTextScreen(x, y += 10, "last full check : " + enemyCommandInfo.lastFullCheckFrame);
-// x += 140;
-// }
-//
-// }
-//
-// }
-//
-// private int drawCalculation(int x, int y) {
-// y += 10;
-// Broodwar.drawTextScreen(x, y += 10, UxColor.CHAR_RED + "Decision : " + AttackDecisionMaker.Instance().decision + ", phase3: " + EnemyStrategyAnalyzer.Instance().getPhase() + ", strategy" + StrategyBoard.currentStrategy.name());
-// Broodwar.drawTextScreen(x, y += 10, "MineralToPredict: " + AttackDecisionMaker.Instance().UXMineralToPredict);
-// Broodwar.drawTextScreen(x, y += 10, "GasToPredict : " + AttackDecisionMaker.Instance().UXGasToPredict);
-// Broodwar.drawTextScreen(x, y += 10, "MineralMinus: : " + AttackDecisionMaker.Instance().UXMinusMineralToPredict);
-// Broodwar.drawTextScreen(x, y += 10, "GasMinus : " + AttackDecisionMaker.Instance().UXMinusGasToPredict);
-//
-// Broodwar.drawTextScreen(x, y += 10, "my point : " + AttackDecisionMaker.Instance().tempMypoint);
-// Broodwar.drawTextScreen(x, y += 10, "enemy point : " + AttackDecisionMaker.Instance().tempEnemypoint);
-// return y;
-// }
-
- private void drawDecision() {
- for (Integer unitId : decisionListForUx.keySet()) {
- Unit unit = Broodwar.getUnit(unitId);
- MicroDecision decision = decisionListForUx.get(unitId);
- Broodwar.drawTextMap(unit.getPosition(), UxColor.CHAR_YELLOW + decision.toString());
- if (decision.eui != null) {
- Broodwar.drawLineMap(unit.getPosition(), decision.eui.getLastPosition(), Color.Yellow);
- }
- }
- }
-
- public void addDecisionListForUx(Unit unit, MicroDecision decision) {
- decisionListForUx.put(unit.getID(), decision);
- }
-
- public void clearDecisionListForUx() {
- decisionListForUx.clear();
- }
-
- private void drawTimer() {
- char battleColor = UxColor.CHAR_WHITE;
- if (StrategyBoard.initiated) {
- battleColor = UxColor.CHAR_RED;
- }
- Broodwar.drawTextScreen(170, 353, battleColor + StrategyBoard.mainSquadMode.toString() + ": " + DrawingUtils.framesToTimeString(TimeUtils.getFrame()) + "(" + TimeUtils.getFrame() + ")");
-
- char apmColor = UxColor.CHAR_WHITE;
- int apm = Broodwar.getAPM();
- if (apm > 3000) {
- apmColor = UxColor.CHAR_RED;
- } else if (apm > 2000) {
- apmColor = UxColor.CHAR_YELLOW;
- } else if (apm > 1000) {
- apmColor = UxColor.CHAR_GREEN;
- } else {
- apmColor = UxColor.CHAR_WHITE;
- }
- Broodwar.drawTextScreen(395, 353, apmColor + "APM : " + Broodwar.getAPM());
- }
-
- private void drawEnemyBuildTimer() {
-
- Map buildTimeExpectMap = EnemyBuildTimer.Instance().buildTimeExpectMap;
- Map buildTimeMinimumMap = EnemyBuildTimer.Instance().buildTimeMinimumMap;
- Set buildTimeCertain = EnemyBuildTimer.Instance().buildTimeCertain;
-
- int y = 20;
- Broodwar.drawTextScreen(20, y += 15, "engine Build Frame : " + DrawingUtils.framesToTimeString(StrategyBoard.engineeringBayBuildStartFrame));
- Broodwar.drawTextScreen(20, y += 15, "turret Build Frame : " + DrawingUtils.framesToTimeString(StrategyBoard.turretBuildStartFrame));
- Broodwar.drawTextScreen(20, y += 15, "turret Need Frame : " + DrawingUtils.framesToTimeString(StrategyBoard.turretNeedFrame));
- y += 15;
-
- Broodwar.drawTextScreen(20, y += 15, "academy Build Frame : " + DrawingUtils.framesToTimeString(StrategyBoard.academyFrame));
- Broodwar.drawTextScreen(20, y += 15, "comsat Build Frame : " + DrawingUtils.framesToTimeString(StrategyBoard.academyFrame + UnitType.Terran_Academy.buildTime()));
- y += 15;
-
- Broodwar.drawTextScreen(20, y += 15, "darkTemplarInMyBaseFrame : " + DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().darkTemplarInMyBaseFrame));
- Broodwar.drawTextScreen(20, y += 15, "reaverInMyBaseFrame : " + DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().reaverInMyBaseFrame));
- Broodwar.drawTextScreen(20, y += 15, "mutaliskInMyBaseFrame : " + DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().mutaliskInMyBaseFrame));
- Broodwar.drawTextScreen(20, y += 15, "lurkerInMyBaseFrame : " + DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().lurkerInMyBaseFrame));
- y += 15;
-
- for (UnitType unitType : buildTimeExpectMap.keySet()) {
- Integer buildTimeExpect = buildTimeExpectMap.get(unitType);
- if (buildTimeExpect != null && buildTimeExpect != CommonCode.UNKNOWN) {
- String expect = DrawingUtils.framesToTimeString(buildTimeExpect);
- String minimum = "";
- Integer buildMinimum = buildTimeMinimumMap.get(unitType);
- if (buildMinimum != null && buildMinimum != CommonCode.UNKNOWN) {
- minimum = DrawingUtils.framesToTimeString(buildMinimum);
- }
-
- Broodwar.drawTextScreen(20, y += 15, unitType + " : " + expect + " - min: " + minimum + " (" + buildTimeCertain.contains(unitType) + ")");
- }
- }
- }
-
- private void drawDebugginUxMenu() {
- Broodwar.drawTextScreen(20, 20, "1. Default Information");
- Broodwar.drawTextScreen(20, 35, "2. Strategy Information");
- Broodwar.drawTextScreen(20, 50, "3. Position Finder Test");
- Broodwar.drawTextScreen(20, 65, "4. Air Micro Test");
- Broodwar.drawTextScreen(20, 80, "5. Unit Bast To Base");
- }
-
- // 게임 개요 정보를 Screen 에 표시합니다
- public void drawGameInformationOnScreen(int x, int y) {
-// Broodwar.drawTextScreen(x, y, white + "Players : ");
-// Broodwar.drawTextScreen(x + 50, y, Broodwar.self().getTextColor() + Broodwar.self().getName() + "(" + InformationManager.Instance().selfRace + ") " + white + " vs. " +
-// PlayerUtils.enemyPlayer().getTextColor() + PlayerUtils.enemyPlayer().getName() + "(" + PlayerUtils.enemyRace() + ")");
-// y += 12;
-//
-// Broodwar.drawTextScreen(x, y, white + "Map : ");
-// Broodwar.drawTextScreen(x + 50, y, white + Broodwar.mapFileName() + " (" + Broodwar.mapWidth() + " x " + Broodwar.mapHeight() + " size)");
-// Broodwar.setTextSize();
-// y += 12;
-
-// Broodwar.drawTextScreen(x, y, white + "Time : ");
-// Broodwar.drawTextScreen(x + 50, y, "" + white + TimeUtils.getFrame());
-// Broodwar.drawTextScreen(x + 90, y, "" + white + (int)(TimeUtils.getFrame() / (23.8 * 60)) + ":" + (int)((int)(TimeUtils.getFrame() / 23.8) % 60));
-// y += 11;
-
-
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + "Current Strategy : ");
- Broodwar.drawTextScreen(x + 100, y, "" + UxColor.CHAR_WHITE + StrategyBoard.currentStrategy.name());
- y += 11;
-
- String history = "";
- for (int i = StrategyBoard.strategyHistory.size() - 1; i >= 0; i--) {
- if (i == StrategyBoard.strategyHistory.size() - 3) {
- history = "... " + history;
- break;
- } else {
- history = StrategyBoard.strategyHistory.get(i).name() + " -> " + history;
- }
- }
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + "Strategy History : ");
- Broodwar.drawTextScreen(x + 100, y, "" + UxColor.CHAR_WHITE + history);
- y += 11;
-
- int vultureCount = UnitUtils.getUnitCount(UnitFindStatus.ALL, UnitType.Terran_Vulture);
- int tankCount = UnitUtils.getUnitCount(UnitFindStatus.ALL, UnitType.Terran_Siege_Tank_Tank_Mode, UnitType.Terran_Siege_Tank_Siege_Mode);
- int goliathCount = UnitUtils.getUnitCount(UnitFindStatus.ALL, UnitType.Terran_Goliath);
-
-// UnitType selected = BuildQueueProvider.Instance().getFactoryUnitSelector().getSelected();
-// if (selected != UnitType.None) {
-// factorySelected = selected;
-// }
-
-
- Broodwar.drawTextScreen(x + 100, y + 5, UxColor.CHAR_TEAL + "" + vultureCount + " " + tankCount + " " + goliathCount);
- Broodwar.drawTextScreen(x, y, "" + UxColor.CHAR_WHITE + StrategyBoard.factoryRatio + ", selected=" + factorySelected);
- y += 11;
-
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + "Wraith Count : ");
- Broodwar.drawTextScreen(x + 75, y, "" + UxColor.CHAR_WHITE + StrategyBoard.wraithCount + " / " + UnitUtils.getUnitCount(UnitFindStatus.COMPLETE, UnitType.Terran_Wraith));
- y += 11;
-
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + "Valkyrie Count : ");
- Broodwar.drawTextScreen(x + 75, y, "" + UxColor.CHAR_WHITE + StrategyBoard.valkyrieCount + " / " + UnitUtils.getUnitCount(UnitFindStatus.COMPLETE, UnitType.Terran_Valkyrie));
- y += 11;
-
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_RED + "MYKillScore : ");
- Broodwar.drawTextScreen(x + 70, y, "" + UxColor.CHAR_RED + Broodwar.self().getKillScore());
- y += 11;
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_RED + "MYRazingScore : ");
- Broodwar.drawTextScreen(x + 85, y, "" + UxColor.CHAR_RED + Broodwar.self().getRazingScore());
- y += 11;
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_PURPLE + "EnemyKillScore : ");
- Broodwar.drawTextScreen(x + 85, y, "" + UxColor.CHAR_PURPLE + Broodwar.enemy().getKillScore());
- y += 11;
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_PURPLE + "EnemyRazingScore : ");
- Broodwar.drawTextScreen(x + 100, y, "" + UxColor.CHAR_PURPLE + Broodwar.enemy().getRazingScore());
- y += 11;
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_TEAL + "Reserved Resource : " + ConstructionManager.Instance().getReservedMinerals() + " / " + ConstructionManager.Instance().getReservedGas());
- y += 11;
- }
-
- /// APM (Action Per Minute) 숫자를 Screen 에 표시합니다
- public void drawAPM(int x, int y) {
- int bwapiAPM = Broodwar.getAPM();
- Broodwar.drawTextScreen(x, y, "APM : " + bwapiAPM);
- }
-
- /// Players 정보를 Screen 에 표시합니다
- public void drawPlayers() {
- for (Player p : Broodwar.getPlayers()) {
- Broodwar.sendText("Player [" + p.getID() + "]: " + p.getName() + " is in force: " + p.getForce().getName());
- }
- }
-
- /// Player 들의 팀 (Force) 들의 정보를 Screen 에 표시합니다
- public void drawForces() {
- for (Force f : Broodwar.getForces()) {
- Broodwar.sendText("Force " + f.getName() + " has the following players:");
- for (Player p : f.getPlayers()) {
- Broodwar.sendText(" - Player [" + p.getID() + "]: " + p.getName());
- }
- }
- }
-
- /// Unit 의 HitPoint 등 추가 정보를 Map 에 표시합니다
- public void drawUnitExtendedInformationOnMap() {
- int verticalOffset = -10;
-
- for (UnitInfo ui : UnitUtils.getEnemyUnitInfoList()) {
-
- UnitType type = ui.getType();
- int hitPoints = ui.getLastHealth();
- int shields = ui.getLastShields();
-
- Position pos = ui.getLastPosition();
-
- int left = pos.getX() - type.dimensionLeft();
- int right = pos.getX() + type.dimensionRight();
- int top = pos.getY() - type.dimensionUp();
- int bottom = pos.getY() + type.dimensionDown();
-
- // 적 유닛이면 주위에 박스 표시
- if (!Broodwar.isVisible(ui.getLastPosition().toTilePosition())) {
- Broodwar.drawBoxMap(new Position(left, top), new Position(right, bottom), Color.Grey, false);
- Broodwar.drawTextMap(new Position(left + 3, top + 4), ui.getType().toString());
- }
-
- // 유닛의 HitPoint 남아있는 비율 표시
- if (!type.isResourceContainer() && type.maxHitPoints() > 0) {
- double hpRatio = (double) hitPoints / (double) type.maxHitPoints();
-
- Color hpColor = Color.Green;
- if (hpRatio < 0.66) hpColor = Color.Orange;
- if (hpRatio < 0.33) hpColor = Color.Red;
-
- int ratioRight = left + (int) ((right - left) * hpRatio);
- int hpTop = top + verticalOffset;
- int hpBottom = top + 4 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), hpColor, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
-
- int ticWidth = 3;
-
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
-
- // 유닛의 Shield 남아있는 비율 표시
- if (!type.isResourceContainer() && type.maxShields() > 0) {
- double shieldRatio = (double) shields / (double) type.maxShields();
-
- int ratioRight = left + (int) ((right - left) * shieldRatio);
- int hpTop = top - 3 + verticalOffset;
- int hpBottom = top + 1 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Blue, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
-
- int ticWidth = 3;
-
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
- }
-
- // draw neutral units and our units
- for (Unit unit : Broodwar.getAllUnits()) {
- if (unit.getPlayer() == PlayerUtils.enemyPlayer()) {
- continue;
- }
-
- final Position pos = unit.getPosition();
-
- int left = pos.getX() - unit.getType().dimensionLeft();
- int right = pos.getX() + unit.getType().dimensionRight();
- int top = pos.getY() - unit.getType().dimensionUp();
- int bottom = pos.getY() + unit.getType().dimensionDown();
-
- //Monster.game.drawBoxMap(BWAPI.Position(left, top), BWAPI.Position(right, bottom), Color.Grey, false);
-
- // 유닛의 HitPoint 남아있는 비율 표시
- if (!unit.getType().isResourceContainer() && unit.getType().maxHitPoints() > 0) {
- double hpRatio = (double) unit.getHitPoints() / (double) unit.getType().maxHitPoints();
-
- Color hpColor = Color.Green;
- if (hpRatio < 0.66) hpColor = Color.Orange;
- if (hpRatio < 0.33) hpColor = Color.Red;
-
- int ratioRight = left + (int) ((right - left) * hpRatio);
- int hpTop = top + verticalOffset;
- int hpBottom = top + 4 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), hpColor, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), hpColor.Black, false);
-
- int ticWidth = 3;
-
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
-
- // 유닛의 Shield 남아있는 비율 표시
- if (!unit.getType().isResourceContainer() && unit.getType().maxShields() > 0) {
- double shieldRatio = (double) unit.getShields() / (double) unit.getType().maxShields();
-
- int ratioRight = left + (int) ((right - left) * shieldRatio);
- int hpTop = top - 3 + verticalOffset;
- int hpBottom = top + 1 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Blue, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
-
- int ticWidth = 3;
-
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
-
- // Mineral / Gas 가 얼마나 남아있는가
- if (unit.getType().isResourceContainer() && unit.getInitialResources() > 0) {
- double mineralRatio = (double) unit.getResources() / (double) unit.getInitialResources();
-
- int ratioRight = left + (int) ((right - left) * mineralRatio);
- int hpTop = top + verticalOffset;
- int hpBottom = top + 4 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Cyan, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
-
- int ticWidth = 3;
-
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
- }
- }
-
- /// UnitType 별 통계 정보를 Screen 에 표시합니다
- public void drawUnitStatisticsOnScreen1(int x, int y) {
- int currentY = y;
-
- // 아군이 입은 피해 누적값
- currentY += 10;
-
- // 아군 모든 유닛 숫자 합계
- //Broodwar.drawTextScreen(x, currentY, white + " allUnitCount: " + UnitUtils.getUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- // 아군 건설/훈련 완료한 유닛 숫자 합계
- //Broodwar.drawTextScreen(x, currentY, white + " completedUnitCount: " + UnitUtils.getCompletedUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- // 아군 건설/훈련중인 유닛 숫자 합계
- //Broodwar.drawTextScreen(x, currentY, white + " incompleteUnitCount: " + Broodwar.self().incompleteUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- // 아군 유닛 파괴/사망 숫자 누적값
- //Broodwar.drawTextScreen(x, currentY, white + " deadUnitCount: " + Broodwar.self().deadUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- // 상대방 유닛을 파괴/사망 시킨 숫자 누적값
- //Broodwar.drawTextScreen(x, currentY, white + " killedUnitCount: " + Broodwar.self().killedUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- //Broodwar.drawTextScreen(x, currentY, white + " UnitScore: " + Broodwar.self().getUnitScore());
- //currentY += 10;
- //Broodwar.drawTextScreen(x, currentY, white + " RazingScore: " + Broodwar.self().getRazingScore());
- //currentY += 10;
- //Broodwar.drawTextScreen(x, currentY, white + " BuildingScore: " + Broodwar.self().getBuildingScore());
- //currentY += 10;
- //Broodwar.drawTextScreen(x, currentY, white + " KillScore: " + Broodwar.self().getKillScore());
- //currentY += 10;
- }
-
-
- /// BWTA 라이브러리에 의한 Map 분석 결과 정보를 Map 에 표시합니다
- public void drawBWTAResultOnMap() {
- /*//we will iterate through all the base locations, and draw their outlines.
- // C+ . for (std.set.const_iterator i = BWTA.getBaseLocations().begin(); i != BWTA.getBaseLocations().end(); i++)
- for(BaseLocation baseLocation : BWTA.getBaseLocations())
- {
- TilePosition p = baseLocation.getTilePosition();
- Position c = baseLocation.getPosition();
-
- //draw outline of Base location
- Broodwar.drawBoxMap(p.getX() * 32, p.getY() * 32, p.getX() * 32 + 4 * 32, p.getY() * 32 + 3 * 32, Color.Blue);
-
- //draw a circle at each mineral patch
- // C++ : for (BWAPI.Unitset.iterator j = (*i).getStaticMinerals().begin(); j != (*i).getStaticMinerals().end(); j++)
- for(Unit unit : baseLocation.getStaticMinerals())
- {
- Position q = unit.getInitialPosition();
- Broodwar.drawCircleMap(q.getX(), q.getY(), 30, Color.Cyan);
+ private static PreBotUXManager instance = new PreBotUXManager();
+
+ private final int dotRadius = 2;
+ public Unit leader = null;
+ public int uxOption = 0;
+ private boolean hasSavedBWTAInfo = false;
+ private int[][] blue = null;
+ private int[][] cyan = null;
+ private int[][] orange = null;
+ private int[][] purple = null;
+ private List yellow = new ArrayList();
+ private List green1 = new ArrayList();
+ private List green2 = new ArrayList();
+ private List red1 = new ArrayList();
+ private List red2 = new ArrayList();
+ private String bulletTypeName = "";
+ private String tempUnitName = "";
+ protected Game Broodwar;
+ private int L = UxDrawConfig.posMap.get("L");
+ private int M = UxDrawConfig.posMap.get("M");
+ private int R = UxDrawConfig.posMap.get("R");
+ private UxDrawConfig uxDrawConfig;
+
+ public ArrayList[] drawStrategyListOrigin = new ArrayList[9];
+ public HashMap> drawStrategyListMap = new HashMap>();
+ public ArrayList drawStrategyLeftList = new ArrayList();
+ public ArrayList drawStrategyMidList = new ArrayList();
+ public ArrayList drawStrategyRightList = new ArrayList();
+
+ private UnitType factorySelected = UnitType.None;
+
+ private Map decisionListForUx = new HashMap<>();
+
+ public PreBotUXManager() {
+ }
+
+ public void onStart(Game Broodwar) {
+ for (int i = 0; i < drawStrategyListOrigin.length; i++) {
+ drawStrategyListOrigin[i] = new ArrayList();
+ }
+ this.Broodwar = Broodwar;
+ }
+
+ // 0..1 : default
+ // 2..3 : custom
+
+ /// static singleton 객체를 리턴합니다
+ public static PreBotUXManager Instance() {
+ return instance;
+ }
+
+ public void setUxOption(int uxOption) {
+ this.uxOption = uxOption;
+ }
+
+ public int getUxOption() {
+ return uxOption;
+ }
+
+ public void update() {
+ ScreenUx.showDisplay();
+ }
+
+ protected void drawUxInfo() {
+ // TODO Auto-generated method stub
+ int y = 10;
+ // setting
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "",
+ "/*****************************************************************************", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "*", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "",
+ "* 1) UX Type Change : d + num ex) d1=?, d0=prebot1 display", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "",
+ "* 2) Change Strategy : $ + Strategy Name ex) $ INIT", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "",
+ "* 3) add Var : a + pos + class + var ex) a L(R/M) strategyBoard startStrategy",
+ UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "",
+ "* 4) minus Var : m + var ex) m startStrategy", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "*", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "",
+ "*****************************************************************************///", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+ }
+
+ public void clearList() {
+ // TODO Auto-generated method stub
+ drawStrategyLeftList.clear();
+ drawStrategyMidList.clear();
+ drawStrategyRightList.clear();
+ }
+
+ private void drawDecision() {
+ for (Integer unitId : decisionListForUx.keySet()) {
+ Unit unit = Broodwar.getUnit(unitId);
+ MicroDecision decision = decisionListForUx.get(unitId);
+ Broodwar.drawTextMap(unit.getPosition(), UxColor.CHAR_YELLOW + decision.toString());
+ if (decision.eui != null) {
+ Broodwar.drawLineMap(unit.getPosition(), decision.eui.getLastPosition(), Color.Yellow);
+ }
+ }
+ }
+
+ public void addDecisionListForUx(Unit unit, MicroDecision decision) {
+ decisionListForUx.put(unit.getID(), decision);
+ }
+
+ public void clearDecisionListForUx() {
+ decisionListForUx.clear();
+ }
+
+ protected void drawTimer() {
+ char battleColor = UxColor.CHAR_WHITE;
+ if (StrategyBoard.initiated) {
+ battleColor = UxColor.CHAR_RED;
+ }
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("M",
+ "", StrategyBoard.mainSquadMode.toString() + ": "
+ + DrawingUtils.framesToTimeString(TimeUtils.getFrame()) + "(" + TimeUtils.getFrame() + ")",
+ battleColor);
+ drawStrategyMidList.add(uxDrawConfig);
+
+ char apmColor = UxColor.CHAR_WHITE;
+ int apm = Broodwar.getAPM();
+ if (apm > 3000) {
+ apmColor = UxColor.CHAR_RED;
+ } else if (apm > 2000) {
+ apmColor = UxColor.CHAR_YELLOW;
+ } else if (apm > 1000) {
+ apmColor = UxColor.CHAR_GREEN;
+ } else {
+ apmColor = UxColor.CHAR_WHITE;
+ }
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("R", "APM : ", Broodwar.getAPM(), apmColor);
+ drawStrategyRightList.add(uxDrawConfig);
+ }
+
+ protected void drawEnemyBuildTimer() {
+
+ Map buildTimeExpectMap = EnemyBuildTimer.Instance().buildTimeExpectMap;
+ Map buildTimeMinimumMap = EnemyBuildTimer.Instance().buildTimeMinimumMap;
+ Set buildTimeCertain = EnemyBuildTimer.Instance().buildTimeCertain;
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "engine Build Frame",
+ DrawingUtils.framesToTimeString(StrategyBoard.engineeringBayBuildStartFrame), UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "turret Build Frame",
+ DrawingUtils.framesToTimeString(StrategyBoard.turretBuildStartFrame), UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "turret Need Frame",
+ DrawingUtils.framesToTimeString(StrategyBoard.turretNeedFrame), UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "darkTemplarInMyBaseFrame",
+ DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().darkTemplarInMyBaseFrame),
+ UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "reaverInMyBaseFrame",
+ DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().reaverInMyBaseFrame), UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "mutaliskInMyBaseFrame",
+ DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().mutaliskInMyBaseFrame), UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "lurkerInMyBaseFrame",
+ DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().lurkerInMyBaseFrame), UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ for (UnitType unitType : buildTimeExpectMap.keySet()) {
+ Integer buildTimeExpect = buildTimeExpectMap.get(unitType);
+ if (buildTimeExpect != null && buildTimeExpect != CommonCode.UNKNOWN) {
+ String expect = DrawingUtils.framesToTimeString(buildTimeExpect);
+ String minimum = "";
+ Integer buildMinimum = buildTimeMinimumMap.get(unitType);
+ if (buildMinimum != null && buildMinimum != CommonCode.UNKNOWN) {
+ minimum = DrawingUtils.framesToTimeString(buildMinimum);
+ }
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", unitType + " : " + expect + " - min: "
+ + minimum + " (" + buildTimeCertain.contains(unitType) + ")", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+ }
+ }
+
+ }
+
+ protected void drawDebugginUxMenu() {
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "1. Default Information", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "2. Strategy Information", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "3. Position Finder Test", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "4. Air Micro Test", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "5. Unit Bast To Base", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", "", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+ }
+
+ // 게임 개요 정보를 Screen 에 표시합니다
+ public void drawGameInformationOnScreen() {
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "Current Strategy", StrategyBoard.currentStrategy.name(),
+ UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ String history = "";
+ for (int i = StrategyBoard.strategyHistory.size() - 1; i >= 0; i--) {
+ if (i == StrategyBoard.strategyHistory.size() - 3) {
+ history = "... " + history;
+ break;
+ } else {
+ history = StrategyBoard.strategyHistory.get(i).name() + " -> " + history;
+ }
+ }
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "MYKillScore", Broodwar.self().getKillScore(),
+ UxColor.CHAR_RED);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "MYRazingScore", Broodwar.self().getRazingScore(),
+ UxColor.CHAR_RED);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "EnemyKillScore", Broodwar.enemy().getKillScore(),
+ UxColor.CHAR_PURPLE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "EnemyRazingScore", Broodwar.enemy().getRazingScore(),
+ UxColor.CHAR_PURPLE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "Reserved Resource",
+ ConstructionManager.Instance().getReservedMinerals() + " / "
+ + ConstructionManager.Instance().getReservedGas(),
+ UxColor.CHAR_TEAL);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ }
+
+ /// Players 정보를 Screen 에 표시합니다
+ public void drawPlayers() {
+ for (Player p : Broodwar.getPlayers()) {
+ Broodwar.sendText("Player [" + p.getID() + "]: " + p.getName() + " is in force: " + p.getForce().getName());
+ }
+ }
+
+ /// Player 들의 팀 (Force) 들의 정보를 Screen 에 표시합니다
+ public void drawForces() {
+ for (Force f : Broodwar.getForces()) {
+ Broodwar.sendText("Force " + f.getName() + " has the following players:");
+ for (Player p : f.getPlayers()) {
+ Broodwar.sendText(" - Player [" + p.getID() + "]: " + p.getName());
+ }
+ }
+ }
+
+ /// Unit 의 HitPoint 등 추가 정보를 Map 에 표시합니다
+ public void drawUnitExtendedInformationOnMap() {
+ int verticalOffset = -10;
+
+ for (UnitInfo ui : UnitUtils.getEnemyUnitInfoList()) {
+
+ UnitType type = ui.getType();
+ int hitPoints = ui.getLastHealth();
+ int shields = ui.getLastShields();
+
+ Position pos = ui.getLastPosition();
+
+ int left = pos.getX() - type.dimensionLeft();
+ int right = pos.getX() + type.dimensionRight();
+ int top = pos.getY() - type.dimensionUp();
+ int bottom = pos.getY() + type.dimensionDown();
+
+ // 적 유닛이면 주위에 박스 표시
+ if (!Broodwar.isVisible(ui.getLastPosition().toTilePosition())) {
+ Broodwar.drawBoxMap(new Position(left, top), new Position(right, bottom), Color.Grey, false);
+ Broodwar.drawTextMap(new Position(left + 3, top + 4), ui.getType().toString());
+ }
+
+ // 유닛의 HitPoint 남아있는 비율 표시
+ if (!type.isResourceContainer() && type.maxHitPoints() > 0) {
+ double hpRatio = (double) hitPoints / (double) type.maxHitPoints();
+
+ Color hpColor = Color.Green;
+ if (hpRatio < 0.66)
+ hpColor = Color.Orange;
+ if (hpRatio < 0.33)
+ hpColor = Color.Red;
+
+ int ratioRight = left + (int) ((right - left) * hpRatio);
+ int hpTop = top + verticalOffset;
+ int hpBottom = top + 4 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), hpColor, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+
+ // 유닛의 Shield 남아있는 비율 표시
+ if (!type.isResourceContainer() && type.maxShields() > 0) {
+ double shieldRatio = (double) shields / (double) type.maxShields();
+
+ int ratioRight = left + (int) ((right - left) * shieldRatio);
+ int hpTop = top - 3 + verticalOffset;
+ int hpBottom = top + 1 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Blue, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+ }
+
+ // draw neutral units and our units
+ for (Unit unit : Broodwar.getAllUnits()) {
+ if (unit.getPlayer() == PlayerUtils.enemyPlayer()) {
+ continue;
+ }
+
+ final Position pos = unit.getPosition();
+
+ int left = pos.getX() - unit.getType().dimensionLeft();
+ int right = pos.getX() + unit.getType().dimensionRight();
+ int top = pos.getY() - unit.getType().dimensionUp();
+ int bottom = pos.getY() + unit.getType().dimensionDown();
+
+ // Monster.game.drawBoxMap(BWAPI.Position(left, top),
+ // BWAPI.Position(right, bottom), Color.Grey, false);
+
+ // 유닛의 HitPoint 남아있는 비율 표시
+ if (!unit.getType().isResourceContainer() && unit.getType().maxHitPoints() > 0) {
+ double hpRatio = (double) unit.getHitPoints() / (double) unit.getType().maxHitPoints();
+
+ Color hpColor = Color.Green;
+ if (hpRatio < 0.66)
+ hpColor = Color.Orange;
+ if (hpRatio < 0.33)
+ hpColor = Color.Red;
+
+ int ratioRight = left + (int) ((right - left) * hpRatio);
+ int hpTop = top + verticalOffset;
+ int hpBottom = top + 4 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), hpColor, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), hpColor.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+
+ // 유닛의 Shield 남아있는 비율 표시
+ if (!unit.getType().isResourceContainer() && unit.getType().maxShields() > 0) {
+ double shieldRatio = (double) unit.getShields() / (double) unit.getType().maxShields();
+
+ int ratioRight = left + (int) ((right - left) * shieldRatio);
+ int hpTop = top - 3 + verticalOffset;
+ int hpBottom = top + 1 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Blue, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+
+ // Mineral / Gas 가 얼마나 남아있는가
+ if (unit.getType().isResourceContainer() && unit.getInitialResources() > 0) {
+ double mineralRatio = (double) unit.getResources() / (double) unit.getInitialResources();
+
+ int ratioRight = left + (int) ((right - left) * mineralRatio);
+ int hpTop = top + verticalOffset;
+ int hpBottom = top + 4 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Cyan, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+ }
+ }
+
+ /// BWTA 라이브러리에 의한 Map 분석 결과 정보를 Map 에 표시합니다
+ public void drawBWTAResultOnMap() {
+ int blueCount = 0;
+ int cyanCount = 0;
+ int orangeCount = 0;
+ // int purpleCount = 0;
+
+ if (hasSavedBWTAInfo == false) {
+ for (BaseLocation baseLocation : BWTA.getBaseLocations()) {
+ blueCount++;
+ // purpleCount++;
+ for (Unit unit : baseLocation.getStaticMinerals()) {
+ cyanCount++;
+ }
+ for (Unit unit : baseLocation.getGeysers()) {
+ orangeCount++;
+ }
+
+ }
+
+ blue = new int[blueCount][4];
+ int blueIndex = 0;
+ cyan = new int[cyanCount][2];
+ int cyanIndex = 0;
+ orange = new int[orangeCount][4];
+ int orangeIndex = 0;
+
+ // purple = new int[purpleCount][4];
+ // int purpleIndex = 0;
+
+ for (BaseLocation baseLocation : BWTA.getBaseLocations()) {
+ TilePosition p = baseLocation.getTilePosition();
+ Position c = baseLocation.getPosition();
+
+ blue[blueIndex][0] = p.getX() * 32;
+ blue[blueIndex][1] = p.getY() * 32;
+ blue[blueIndex][2] = p.getX() * 32 + 4 * 32;
+ blue[blueIndex][3] = p.getY() * 32 + 3 * 32;
+ blueIndex++;
+
+ // purple[purpleIndex][0] = (p.getX()+4) * 32;
+ // purple[purpleIndex][1] = (p.getY()+1) * 32;
+ // purple[purpleIndex][2] = (p.getX()+4) * 32 + 2 * 32;
+ // purple[purpleIndex][3] = (p.getY()+1) * 32 + 2 * 32;
+ // purpleIndex++;
+
+ // draw a circle at each mineral patch
+ // C++ : for (BWAPI.Unitset.iterator j =
+ // (*i).getStaticMinerals().begin(); j !=
+ // (*i).getStaticMinerals().end(); j++)
+ for (Unit unit : baseLocation.getStaticMinerals()) {
+ Position q = unit.getInitialPosition();
+ cyan[cyanIndex][0] = q.getX();
+ cyan[cyanIndex][1] = q.getY();
+ cyanIndex++;
+ }
+
+ // draw the outlines of vespene geysers
+ // C++ : for (BWAPI.Unitset.iterator j =
+ // (*i).getGeysers().begin(); j != (*i).getGeysers().end(); j++)
+ for (Unit unit : baseLocation.getGeysers()) {
+ TilePosition q = unit.getInitialTilePosition();
+ orange[orangeIndex][0] = q.getX() * 32;
+ orange[orangeIndex][1] = q.getY() * 32;
+ orange[orangeIndex][2] = q.getX() * 32 + 4 * 32;
+ orange[orangeIndex][3] = q.getY() * 32 + 2 * 32;
+ orangeIndex++;
+ }
+
+ // if this is an island expansion, draw a yellow circle around
+ // the base location
+ if (baseLocation.isIsland()) {
+ yellow.add(c);
+ }
+ }
+
+ // we will iterate through all the regions and draw the polygon
+ // outline of it in green.
+ // C++ : for (std.set.const_iterator r =
+ // BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
+ for (Region region : BWTA.getRegions()) {
+ Polygon p = region.getPolygon();
+ for (int j = 0; j < p.getPoints().size(); j++) {
+ green1.add(p.getPoints().get(j));
+ green2.add(p.getPoints().get((j + 1) % p.getPoints().size()));
+ }
+ }
+
+ // we will visualize the chokepoints with red lines
+ // C++ : for (std.set.const_iterator r =
+ // BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
+ for (Region region : BWTA.getRegions()) {
+ // C++ : for (std.set.const_iterator c =
+ // (*r).getChokepoints().begin(); c !=
+ // (*r).getChokepoints().end(); c++)
+ for (Chokepoint Chokepoint : region.getChokepoints()) {
+ red1.add(Chokepoint.getSides().first);
+ red2.add(Chokepoint.getSides().second);
+ }
+ }
+ hasSavedBWTAInfo = true;
+
+ // System.out.println(blueCount + " " + cyanCount + " " +
+ // orangeCount + " " + yellowCount + " " + greenCount + " " +
+ // redCount);
+ }
+
+ if (hasSavedBWTAInfo) {
+ for (int i1 = 0; i1 < blue.length; i1++) {
+ Broodwar.drawBoxMap(blue[i1][0], blue[i1][1], blue[i1][2], blue[i1][3], Color.Blue);
+ }
+ // for(int i1=0 ; i1 buildQueue = BuildManager.Instance().buildQueue.getQueue();
+ int itemCount = 0;
+
+ Object[] tempQueue = buildQueue.toArray();
+
+ for (int i = 0; i < tempQueue.length; i++) {
+ BuildOrderItem currentItem = (BuildOrderItem) tempQueue[i];
+ // Broodwar.drawTextScreen(x, y + 10 + (itemCount * 10),
+ // currentItem.blocking + " " + UxColor.CHAR_WHITE +
+ // currentItem.metaType.getName());
+ UxDrawConfig uxDrawConfig;
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("M", "",
+ currentItem.blocking + " " + currentItem.metaType.getName(), UxColor.CHAR_WHITE);
+ drawStrategyMidList.add(uxDrawConfig);
+ itemCount++;
+ if (itemCount >= 24)
+ break;
+ }
+ }
+
+ /// Build 진행 상태를 Screen 에 표시합니다
+ public void drawBuildStatusOnScreen() {
+ // 건설 / 훈련 중인 유닛 진행상황 표시
+ Vector unitsUnderConstruction = new Vector();
+ for (Unit unit : Broodwar.self().getUnits()) {
+ if (unit != null && unit.isBeingConstructed()) {
+ unitsUnderConstruction.add(unit);
}
+ }
+
+ // sort it based on the time it was started
+ Object[] tempArr = unitsUnderConstruction.toArray();
+ // Arrays.sort(tempArr);
+ unitsUnderConstruction = new Vector();
+ for (int i = 0; i < tempArr.length; i++) {
+ unitsUnderConstruction.add((Unit) tempArr[i]);
+ }
+ // C++ : std.sort(unitsUnderConstruction.begin(),
+ // unitsUnderConstruction.end(), CompareWhenStarted());
+
+ // Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + " ");
- //draw the outlines of vespene geysers
- // C++ : for (BWAPI.Unitset.iterator j = (*i).getGeysers().begin(); j != (*i).getGeysers().end(); j++)
- for(Unit unit :baseLocation.getGeysers() )
- {
- TilePosition q = unit.getInitialTilePosition();
- Broodwar.drawBoxMap(q.getX() * 32, q.getY() * 32, q.getX() * 32 + 4 * 32, q.getY() * 32 + 2 * 32, Color.Orange);
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("R", "", " ", UxColor.CHAR_WHITE);
+ drawStrategyRightList.add(uxDrawConfig);
+
+ for (Unit unit : unitsUnderConstruction) {
+ UnitType t = unit.getType();
+ if (t == UnitType.Zerg_Egg) {
+ t = unit.getBuildType();
}
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("R", "",
+ "" + t + " (" + unit.getRemainingBuildTime() + ")", UxColor.CHAR_WHITE);
+ drawStrategyRightList.add(uxDrawConfig);
+ }
- //if this is an island expansion, draw a yellow circle around the base location
- if (baseLocation.isIsland())
- {
- Broodwar.drawCircleMap(c, 80, Color.Yellow);
+ // Tech Research 표시
+
+ // Upgrade 표시
+ }
+
+ /// Construction 을 하기 위해 예약해둔 Tile 들을 Map 에 표시합니다
+ public void drawReservedBuildingTilesOnMap() {
+ boolean[][] reserveMap = ConstructionPlaceFinder.Instance().getReserveMap();
+ if (reserveMap.length > 0 && reserveMap[0] != null && reserveMap[0].length > 0) {
+ int rwidth = reserveMap.length;
+ int rheight = reserveMap[0].length;
+
+ for (int x = 0; x < rwidth; ++x) {
+ for (int y = 0; y < rheight; ++y) {
+ if (reserveMap[x][y]) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Yellow, false);
+ }
+ }
+ }
+ }
+ }
+
+ /// Construction 을 하지 못하는 Tile 들을 Map 에 표시합니다
+ public void drawTilesToAvoidOnMap() {
+ int y = 0;
+ int x = 0;
+
+ for (y = 0; y < 128; y++) {
+ for (x = 0; x < 128; x++) {
+ if (ConstructionPlaceFinder.Instance().getTilesToAvoid(x, y)) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Orange, false);
+ }
+ if (ConstructionPlaceFinder.Instance().getTilesToAvoidAbsolute(x, y)) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Purple, false);
+ }
+ if (ConstructionPlaceFinder.Instance().getTilesToAvoidSupply(x, y)) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Red, false);
+ }
}
}
+ }
+
+ /// ConstructionQueue 를 Screen 에 표시합니다
+ public void drawConstructionQueueOnScreenAndMap() {
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("M", "", " ", UxColor.CHAR_WHITE);
+ drawStrategyMidList.add(uxDrawConfig);
+
+ Vector constructionQueue = ConstructionManager.Instance().getConstructionQueue();
+
+ for (final ConstructionTask b : constructionQueue) {
+ if (b.getStatus() == ConstructionTask.ConstructionStatus.Unassigned.ordinal()) {
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("M", "", "" + b.getType() + " - No Worker",
+ UxColor.CHAR_WHITE);
+ drawStrategyMidList.add(uxDrawConfig);
+ } else if (b.getStatus() == ConstructionTask.ConstructionStatus.Assigned.ordinal()) {
+ if (b.getConstructionWorker() == null) {
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("M", "", b.getType() + " - Assigned Worker Null",
+ UxColor.CHAR_WHITE);
+ drawStrategyMidList.add(uxDrawConfig);
+ } else {
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("M", "",
+ b.getType() + " - Assigned Worker " + b.getConstructionWorker().getID() + ", Position ("
+ + b.getFinalPosition().getX() + "," + b.getFinalPosition().getY() + ")",
+ UxColor.CHAR_WHITE);
+ drawStrategyMidList.add(uxDrawConfig);
+ }
+
+ int x1 = b.getFinalPosition().getX() * 32;
+ int y1 = b.getFinalPosition().getY() * 32;
+ int x2 = (b.getFinalPosition().getX() + b.getType().tileWidth()) * 32;
+ int y2 = (b.getFinalPosition().getY() + b.getType().tileHeight()) * 32;
+
+ Broodwar.drawLineMap(b.getConstructionWorker().getPosition().getX(),
+ b.getConstructionWorker().getPosition().getY(), (x1 + x2) / 2, (y1 + y2) / 2, Color.Orange);
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Red, false);
+ } else if (b.getStatus() == ConstructionTask.ConstructionStatus.UnderConstruction.ordinal()) {
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("M", "", "" + b.getType() + " - Under Construction",
+ UxColor.CHAR_WHITE);
+ drawStrategyMidList.add(uxDrawConfig);
+ }
+ }
+ }
- //we will iterate through all the regions and draw the polygon outline of it in green.
- // C++ : for (std.set.const_iterator r = BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
- for(Region region : BWTA.getRegions())
- {
- Polygon p = region.getPolygon();
- for (int j = 0; j.const_iterator r = BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
- for(Region region : BWTA.getRegions())
- {
- // C++ : for (std.set.const_iterator c = (*r).getChokepoints().begin(); c != (*r).getChokepoints().end(); c++)
- for(Chokepoint Chokepoint : region.getChokepoints())
- {
- Position point1 = Chokepoint.getSides().first;
- Position point2 = Chokepoint.getSides().second;
- Broodwar.drawLineMap(point1, point2, Color.Red);
}
- }*/
- int blueCount = 0;
- int cyanCount = 0;
- int orangeCount = 0;
-// int purpleCount = 0;
-
- if (hasSavedBWTAInfo == false) {
- for (BaseLocation baseLocation : BWTA.getBaseLocations()) {
- blueCount++;
-// purpleCount++;
- for (Unit unit : baseLocation.getStaticMinerals()) {
- cyanCount++;
- }
- for (Unit unit : baseLocation.getGeysers()) {
- orangeCount++;
- }
-
- }
-
- blue = new int[blueCount][4];
- int blueIndex = 0;
- cyan = new int[cyanCount][2];
- int cyanIndex = 0;
- orange = new int[orangeCount][4];
- int orangeIndex = 0;
-
-// purple = new int[purpleCount][4];
-// int purpleIndex = 0;
-
- for (BaseLocation baseLocation : BWTA.getBaseLocations()) {
- TilePosition p = baseLocation.getTilePosition();
- Position c = baseLocation.getPosition();
-
- blue[blueIndex][0] = p.getX() * 32;
- blue[blueIndex][1] = p.getY() * 32;
- blue[blueIndex][2] = p.getX() * 32 + 4 * 32;
- blue[blueIndex][3] = p.getY() * 32 + 3 * 32;
- blueIndex++;
-
-// purple[purpleIndex][0] = (p.getX()+4) * 32;
-// purple[purpleIndex][1] = (p.getY()+1) * 32;
-// purple[purpleIndex][2] = (p.getX()+4) * 32 + 2 * 32;
-// purple[purpleIndex][3] = (p.getY()+1) * 32 + 2 * 32;
-// purpleIndex++;
-
- //draw a circle at each mineral patch
- // C++ : for (BWAPI.Unitset.iterator j = (*i).getStaticMinerals().begin(); j != (*i).getStaticMinerals().end(); j++)
- for (Unit unit : baseLocation.getStaticMinerals()) {
- Position q = unit.getInitialPosition();
- cyan[cyanIndex][0] = q.getX();
- cyan[cyanIndex][1] = q.getY();
- cyanIndex++;
- }
-
- //draw the outlines of vespene geysers
- // C++ : for (BWAPI.Unitset.iterator j = (*i).getGeysers().begin(); j != (*i).getGeysers().end(); j++)
- for (Unit unit : baseLocation.getGeysers()) {
- TilePosition q = unit.getInitialTilePosition();
- orange[orangeIndex][0] = q.getX() * 32;
- orange[orangeIndex][1] = q.getY() * 32;
- orange[orangeIndex][2] = q.getX() * 32 + 4 * 32;
- orange[orangeIndex][3] = q.getY() * 32 + 2 * 32;
- orangeIndex++;
- }
-
- //if this is an island expansion, draw a yellow circle around the base location
- if (baseLocation.isIsland()) {
- yellow.add(c);
- }
- }
-
- //we will iterate through all the regions and draw the polygon outline of it in green.
- // C++ : for (std.set.const_iterator r = BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
- for (Region region : BWTA.getRegions()) {
- Polygon p = region.getPolygon();
- for (int j = 0; j < p.getPoints().size(); j++) {
- green1.add(p.getPoints().get(j));
- green2.add(p.getPoints().get((j + 1) % p.getPoints().size()));
- }
- }
-
- //we will visualize the chokepoints with red lines
- // C++ : for (std.set.const_iterator r = BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
- for (Region region : BWTA.getRegions()) {
- // C++ : for (std.set.const_iterator c = (*r).getChokepoints().begin(); c != (*r).getChokepoints().end(); c++)
- for (Chokepoint Chokepoint : region.getChokepoints()) {
- red1.add(Chokepoint.getSides().first);
- red2.add(Chokepoint.getSides().second);
- }
- }
- hasSavedBWTAInfo = true;
-
-// System.out.println(blueCount + " " + cyanCount + " " + orangeCount + " " + yellowCount + " " + greenCount + " " + redCount);
- }
-
- if (hasSavedBWTAInfo) {
- for (int i1 = 0; i1 < blue.length; i1++) {
- Broodwar.drawBoxMap(blue[i1][0], blue[i1][1], blue[i1][2], blue[i1][3], Color.Blue);
- }
-// for(int i1=0 ; i1 buildQueue = BuildManager.Instance().buildQueue.getQueue();
- int itemCount = 0;
-
- Object[] tempQueue = buildQueue.toArray();
-
- for (int i = 0; i < tempQueue.length; i++) {
- BuildOrderItem currentItem = (BuildOrderItem) tempQueue[i];
- Broodwar.drawTextScreen(x, y + 10 + (itemCount * 10), currentItem.blocking + " " + UxColor.CHAR_WHITE + currentItem.metaType.getName());
- itemCount++;
- if (itemCount >= 24) break;
- }
- }
-
- /// Build 진행 상태를 Screen 에 표시합니다
- public void drawBuildStatusOnScreen(int x, int y) {
- // 건설 / 훈련 중인 유닛 진행상황 표시
- Vector unitsUnderConstruction = new Vector();
- for (Unit unit : Broodwar.self().getUnits()) {
- if (unit != null && unit.isBeingConstructed()) {
- unitsUnderConstruction.add(unit);
- }
- }
-
- // sort it based on the time it was started
- Object[] tempArr = unitsUnderConstruction.toArray();
- //Arrays.sort(tempArr);
- unitsUnderConstruction = new Vector();
- for (int i = 0; i < tempArr.length; i++) {
- unitsUnderConstruction.add((Unit) tempArr[i]);
- }
- // C++ : std.sort(unitsUnderConstruction.begin(), unitsUnderConstruction.end(), CompareWhenStarted());
-
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + " ");
-
- int reps = unitsUnderConstruction.size() < 10 ? unitsUnderConstruction.size() : 10;
-
- for (Unit unit : unitsUnderConstruction) {
- y += 10;
- UnitType t = unit.getType();
- if (t == UnitType.Zerg_Egg) {
- t = unit.getBuildType();
- }
-
- Broodwar.drawTextScreen(x, y, "" + UxColor.CHAR_WHITE + t + " (" + unit.getRemainingBuildTime() + ")");
- }
-
- // Tech Research 표시
-
- // Upgrade 표시
- }
-
- /// Construction 을 하기 위해 예약해둔 Tile 들을 Map 에 표시합니다
- public void drawReservedBuildingTilesOnMap() {
- boolean[][] reserveMap = ConstructionPlaceFinder.Instance().getReserveMap();
- if (reserveMap.length > 0 && reserveMap[0] != null && reserveMap[0].length > 0) {
- int rwidth = reserveMap.length;
- int rheight = reserveMap[0].length;
-
- for (int x = 0; x < rwidth; ++x) {
- for (int y = 0; y < rheight; ++y) {
- if (reserveMap[x][y]) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Yellow, false);
- }
- }
- }
- }
- }
-
- /// Construction 을 하지 못하는 Tile 들을 Map 에 표시합니다
- public void drawTilesToAvoidOnMap() {
- int y = 0;
- int x = 0;
-
- for (y = 0; y < 128; y++) {
- for (x = 0; x < 128; x++) {
- if (ConstructionPlaceFinder.Instance().getTilesToAvoid(x, y)) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Orange, false);
- }
- if (ConstructionPlaceFinder.Instance().getTilesToAvoidAbsolute(x, y)) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Purple, false);
- }
- if (ConstructionPlaceFinder.Instance().getTilesToAvoidSupply(x, y)) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Red, false);
- }
- }
- }
- }
-
- /// ConstructionQueue 를 Screen 에 표시합니다
- public void drawConstructionQueueOnScreenAndMap(int x, int y) {
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + " ");
-
- int yspace = 0;
-
- Vector constructionQueue = ConstructionManager.Instance().getConstructionQueue();
-
- for (final ConstructionTask b : constructionQueue) {
- String constructionState = "";
-
- if (b.getStatus() == ConstructionTask.ConstructionStatus.Unassigned.ordinal()) {
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), "" + UxColor.CHAR_WHITE + b.getType() + " - No Worker");
- } else if (b.getStatus() == ConstructionTask.ConstructionStatus.Assigned.ordinal()) {
- if (b.getConstructionWorker() == null) {
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), b.getType() + " - Assigned Worker Null");
- } else {
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), b.getType() + " - Assigned Worker " + b.getConstructionWorker().getID() + ", Position (" + b.getFinalPosition().getX() + "," + b.getFinalPosition().getY() + ")");
- }
-
- int x1 = b.getFinalPosition().getX() * 32;
- int y1 = b.getFinalPosition().getY() * 32;
- int x2 = (b.getFinalPosition().getX() + b.getType().tileWidth()) * 32;
- int y2 = (b.getFinalPosition().getY() + b.getType().tileHeight()) * 32;
-
- Broodwar.drawLineMap(b.getConstructionWorker().getPosition().getX(), b.getConstructionWorker().getPosition().getY(), (x1 + x2) / 2, (y1 + y2) / 2, Color.Orange);
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Red, false);
- } else if (b.getStatus() == ConstructionTask.ConstructionStatus.UnderConstruction.ordinal()) {
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), "" + UxColor.CHAR_WHITE + b.getType() + " - Under Construction");
- }
- yspace++;
- }
- }
-
- public void drawnextPoints() {
-
-// Position nextEX = InformationManager.Instance().getNextExpansionLocation().getPosition();
-// Position nextBuild = InformationManager.Instance().getLastBuildingLocation().toPosition();
-// Position lastBuild2 = InformationManager.Instance().getLastBuildingLocation2().toPosition();
-
-// BaseLocation getExpansionLocation = InformationManager.Instance().getExpansionLocation;
-// BaseLocation secondStartPosition = null;//InformationManager.Instance().getSecondStartPosition();
-// TilePosition getLastBuildingLocation = InformationManager.Instance().getLastBuildingLocation;
-// TilePosition getLastBuildingFinalLocation = InformationManager.Instance().getLastBuildingFinalLocation;
-//
-//
-// if (secondStartPosition != null) {
-// Broodwar.drawTextScreen(10, 120, "secondStartPosition: " + secondStartPosition.getTilePosition());
-// Broodwar.drawTextMap(secondStartPosition.getPosition(), "secondStartPosition");
-// } else {
-// Broodwar.drawTextScreen(10, 120, "secondStartPosition: null");
-// }
-// if (getExpansionLocation != null) {
-// Broodwar.drawTextScreen(10, 130, "getExpansionLocation: " + getExpansionLocation.getTilePosition());
-// Broodwar.drawTextMap(getExpansionLocation.getPosition(), "nextEX");
-// } else {
-// Broodwar.drawTextScreen(10, 130, "getExpansionLocation: null");
-// }
-// if (getLastBuildingLocation != null) {
-// Broodwar.drawTextScreen(10, 140, "getLastBuildingLocation: " + getLastBuildingLocation);
-// Broodwar.drawTextMap(getLastBuildingLocation.toPosition(), "nextBuild");
-// } else {
-// Broodwar.drawTextScreen(10, 140, "getLastBuildingLocation: null");
-// }
-// if (getLastBuildingFinalLocation != null) {
-// Broodwar.drawTextScreen(10, 150, "getLastBuildingFinalLocation: " + getLastBuildingFinalLocation);
-// Broodwar.drawTextMap(getLastBuildingFinalLocation.toPosition(), "LastBuild");
-// } else {
-// Broodwar.drawTextScreen(10, 150, "getLastBuildingFinalLocation: null");
-// }
-//
-//
-// Broodwar.drawTextScreen(10, 160, "mainBaseLocationFull: " + BuildManager.Instance().mainBaseLocationFull);
-// Broodwar.drawTextScreen(10, 170, "secondChokePointFull: " + BuildManager.Instance().secondChokePointFull);
-// Broodwar.drawTextScreen(10, 180, "secondStartLocationFull: " + BuildManager.Instance().secondStartLocationFull);
-// Broodwar.drawTextScreen(10, 190, "fisrtSupplePointFull: " + BuildManager.Instance().fisrtSupplePointFull);
-//
-// Broodwar.drawTextScreen(10, 200, "myMainbaseLocation : " + BaseUtils.myMainBase().getTilePosition());
-// Broodwar.drawTextScreen(10, 210, "enemyMainbaseLocation : " + BaseUtils.enemyMainBase().getTilePosition());
-
- }
-
-
- public void drawMineralIdOnMap() {
- for (Unit unit : Broodwar.getStaticMinerals()) {
-
- Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + UxColor.CHAR_WHITE + unit.getID());
- }
- }
-
- /// Unit 의 Id 를 Map 에 표시합니다
- public void drawUnitIdOnMap() {
- for (Unit unit : Broodwar.self().getUnits()) {
- if (unit.getType().isBuilding()) {
- Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + UxColor.CHAR_WHITE + unit.getID());
- Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 25, "" + UxColor.CHAR_WHITE + unit.getTilePosition().getX() + " / " + unit.getTilePosition().getY());
- } else {
- Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + UxColor.CHAR_WHITE + unit.getID());
- }
-
- }
- for (Unit unit : Broodwar.enemy().getUnits()) {
- Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + UxColor.CHAR_WHITE + unit.getID());
- }
- }
-
- public void drawLeaderUnitOnMap() {
-
-//
-// if(leader!=null){
-// for (Unit unit : Broodwar.self().getUnits())
-// {
-// if(unit.getID() == leader.getID())
-// Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + blue + "LEADER");
-// }
-// }
- }
-
- /// Worker Unit 들의 상태를 Screen 에 표시합니다
- public void drawWorkerStateOnScreen(int x, int y) {
- WorkerData workerData = WorkerManager.Instance().getWorkerData();
-
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + "");
-
- int yspace = 0;
-
- for (Unit unit : workerData.getWorkers()) {
- if (unit == null) continue;
-
- // Mineral / Gas / Idle Worker 는 표시 안한다
- if (workerData.getJobCode(unit) == 'M' || workerData.getJobCode(unit) == 'I' || workerData.getJobCode(unit) == 'G') {
- continue;
- }
-
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), UxColor.CHAR_WHITE + " " + unit.getID());
-
- if (workerData.getJobCode(unit) == 'B') {
- Broodwar.drawTextScreen(x + 30, y + 10 + ((yspace++) * 10), UxColor.CHAR_WHITE + " " + workerData.getJobCode(unit) + " " + unit.getBuildType() + " " + (unit.isConstructing() ? 'Y' : 'N') + " (" + unit.getTilePosition().getX() + ", " + unit.getTilePosition().getY() + ")");
- } else {
- Broodwar.drawTextScreen(x + 30, y + 10 + ((yspace++) * 10), UxColor.CHAR_WHITE + " " + workerData.getJobCode(unit));
- }
- }
- }
-
- /// ResourceDepot 별 Worker 숫자를 Map 에 표시합니다
- public void drawWorkerCountOnMap() {
- for (Unit depot : WorkerManager.Instance().getWorkerData().getDepots()) {
- if (depot == null) continue;
-
- int x = depot.getPosition().getX() - 64;
- int y = depot.getPosition().getY() - 32;
-
- Broodwar.drawBoxMap(x - 2, y - 1, x + 75, y + 14, Color.Black, true);
- Broodwar.drawTextMap(x, y, UxColor.CHAR_WHITE + " Workers: " + WorkerManager.Instance().getWorkerData().getNumAssignedWorkers(depot));
- }
- }
-
- /// Worker Unit 의 자원채취 현황을 Map 에 표시합니다
- public void drawWorkerMiningStatusOnMap() {
- WorkerData workerData = WorkerManager.Instance().getWorkerData();
-
- for (Unit worker : workerData.getWorkers()) {
- if (worker == null) continue;
-
- Position pos = worker.getTargetPosition();
-
- Broodwar.drawTextMap(worker.getPosition().getX(), worker.getPosition().getY() - 5, "" + UxColor.CHAR_WHITE + workerData.getJobCode(worker));
-
- Broodwar.drawLineMap(worker.getPosition().getX(), worker.getPosition().getY(), pos.getX(), pos.getY(), Color.Cyan);
-
- /*
- // ResourceDepot ~ Worker 사이에 직선 표시
- BWAPI.Unit depot = workerData.getWorkerDepot(worker);
- if (depot) {
- Monster.game.drawLineMap(worker.getPosition().x, worker.getPosition().y, depot.getPosition().x, depot.getPosition().y, Color.Orange);
+ }
+ }
+
+ /// Bullet 을 Map 에 표시합니다
+ /// Cloaking Unit 의 Bullet 표시에 쓰입니다
+ public void drawBulletsOnMap() {
+ for (Bullet b : Broodwar.getBullets()) {
+ Position p = b.getPosition();
+ double velocityX = b.getVelocityX();
+ double velocityY = b.getVelocityY();
+
+ if (b.getType() == BulletType.Acid_Spore)
+ bulletTypeName = "Acid_Spore";
+ else if (b.getType() == BulletType.Anti_Matter_Missile)
+ bulletTypeName = "Anti_Matter_Missile";
+ else if (b.getType() == BulletType.Arclite_Shock_Cannon_Hit)
+ bulletTypeName = "Arclite_Shock_Cannon_Hit";
+ else if (b.getType() == BulletType.ATS_ATA_Laser_Battery)
+ bulletTypeName = "ATS_ATA_Laser_Battery";
+ else if (b.getType() == BulletType.Burst_Lasers)
+ bulletTypeName = "Burst_Lasers";
+ else if (b.getType() == BulletType.C_10_Canister_Rifle_Hit)
+ bulletTypeName = "C_10_Canister_Rifle_Hit";
+ else if (b.getType() == BulletType.Consume)
+ bulletTypeName = "Consume";
+ else if (b.getType() == BulletType.Corrosive_Acid_Shot)
+ bulletTypeName = "Corrosive_Acid_Shot";
+ else if (b.getType() == BulletType.Dual_Photon_Blasters_Hit)
+ bulletTypeName = "Dual_Photon_Blasters_Hit";
+ else if (b.getType() == BulletType.EMP_Missile)
+ bulletTypeName = "EMP_Missile";
+ else if (b.getType() == BulletType.Ensnare)
+ bulletTypeName = "Ensnare";
+ else if (b.getType() == BulletType.Fragmentation_Grenade)
+ bulletTypeName = "Fragmentation_Grenade";
+ else if (b.getType() == BulletType.Fusion_Cutter_Hit)
+ bulletTypeName = "Fusion_Cutter_Hit";
+ else if (b.getType() == BulletType.Gauss_Rifle_Hit)
+ bulletTypeName = "Gauss_Rifle_Hit";
+ else if (b.getType() == BulletType.Gemini_Missiles)
+ bulletTypeName = "Gemini_Missiles";
+ else if (b.getType() == BulletType.Glave_Wurm)
+ bulletTypeName = "Glave_Wurm";
+ else if (b.getType() == BulletType.Halo_Rockets)
+ bulletTypeName = "Halo_Rockets";
+ else if (b.getType() == BulletType.Invisible)
+ bulletTypeName = "Invisible";
+ else if (b.getType() == BulletType.Longbolt_Missile)
+ bulletTypeName = "Longbolt_Missile";
+ else if (b.getType() == BulletType.Melee)
+ bulletTypeName = "Melee";
+ else if (b.getType() == BulletType.Needle_Spine_Hit)
+ bulletTypeName = "Needle_Spine_Hit";
+ else if (b.getType() == BulletType.Neutron_Flare)
+ bulletTypeName = "Neutron_Flare";
+ else if (b.getType() == BulletType.None)
+ bulletTypeName = "None";
+ else if (b.getType() == BulletType.Optical_Flare_Grenade)
+ bulletTypeName = "Optical_Flare_Grenade";
+ else if (b.getType() == BulletType.Particle_Beam_Hit)
+ bulletTypeName = "Particle_Beam_Hit";
+ else if (b.getType() == BulletType.Phase_Disruptor)
+ bulletTypeName = "Phase_Disruptor";
+ else if (b.getType() == BulletType.Plague_Cloud)
+ bulletTypeName = "Plague_Cloud";
+ else if (b.getType() == BulletType.Psionic_Shockwave_Hit)
+ bulletTypeName = "Psionic_Shockwave_Hit";
+ else if (b.getType() == BulletType.Psionic_Storm)
+ bulletTypeName = "Psionic_Storm";
+ else if (b.getType() == BulletType.Pulse_Cannon)
+ bulletTypeName = "Pulse_Cannon";
+ else if (b.getType() == BulletType.Queen_Spell_Carrier)
+ bulletTypeName = "Queen_Spell_Carrier";
+ else if (b.getType() == BulletType.Seeker_Spores)
+ bulletTypeName = "Seeker_Spores";
+ else if (b.getType() == BulletType.STA_STS_Cannon_Overlay)
+ bulletTypeName = "STA_STS_Cannon_Overlay";
+ else if (b.getType() == BulletType.Subterranean_Spines)
+ bulletTypeName = "Subterranean_Spines";
+ else if (b.getType() == BulletType.Sunken_Colony_Tentacle)
+ bulletTypeName = "Sunken_Colony_Tentacle";
+ else if (b.getType() == BulletType.Unknown)
+ bulletTypeName = "Unknown";
+ else if (b.getType() == BulletType.Yamato_Gun)
+ bulletTypeName = "Yamato_Gun";
+
+ // 아군 것이면 녹색, 적군 것이면 빨간색
+ Broodwar.drawLineMap(p, new Position(p.getX() + (int) velocityX, p.getY() + (int) velocityY),
+ b.getPlayer() == Broodwar.self() ? Color.Green : Color.Red);
+ if (b.getType() != null) {
+ Broodwar.drawTextMap(p,
+ (b.getPlayer() == Broodwar.self() ? "" + UxColor.CHAR_TEAL : "" + UxColor.CHAR_RED)
+ + bulletTypeName);
+ }
+ }
+ }
+
+ protected void drawSquadUnitTagMap() {
+ // draw neutral units and our units
+ for (Squad squad : CombatManager.Instance().squadData.getSquadMap().values()) {
+ Color color = UxColor.SQUAD_COLOR.get(squad.getClass());
+ if (color == null) {
+ continue;
}
- */
- }
- }
-
- /// 정찰 상태를 Screen 에 표시합니다
- public void drawScoutInformation(int x, int y) {
-
- // get the enemy base location, if we have one
- BaseLocation enemyBaseLocation = BaseUtils.enemyMainBase();
-
- if (enemyBaseLocation != null) {
- Broodwar.drawTextScreen(x, y, "Enemy MainBaseLocation : (" + enemyBaseLocation.getTilePosition().getX() + ", " + enemyBaseLocation.getTilePosition().getY() + ")");
- } else {
- Broodwar.drawTextScreen(x, y, "Enemy MainBaseLocation : Unknown");
- }
- }
-
- /// Unit 의 Target 으로 잇는 선을 Map 에 표시합니다
- public void drawUnitTargetOnMap() {
- for (Unit unit : Broodwar.self().getUnits()) {
- if (unit != null && unit.isCompleted() && !unit.getType().isBuilding() && !unit.getType().isWorker()) {
- Unit targetUnit = unit.getTarget();
- if (targetUnit != null && targetUnit.getPlayer() != Broodwar.self()) {
- Broodwar.drawCircleMap(unit.getPosition(), dotRadius, Color.Red, true);
- Broodwar.drawCircleMap(targetUnit.getTargetPosition(), dotRadius, Color.Red, true);
- Broodwar.drawLineMap(unit.getPosition(), targetUnit.getTargetPosition(), Color.Red);
- } else if (unit.isMoving()) {
- Broodwar.drawCircleMap(unit.getPosition(), dotRadius, Color.Orange, true);
- Broodwar.drawCircleMap(unit.getTargetPosition(), dotRadius, Color.Orange, true);
- Broodwar.drawLineMap(unit.getPosition(), unit.getTargetPosition(), Color.Orange);
- }
-
- }
- }
- }
-
- /// Bullet 을 Map 에 표시합니다
- /// Cloaking Unit 의 Bullet 표시에 쓰입니다
- public void drawBulletsOnMap() {
- for (Bullet b : Broodwar.getBullets()) {
- Position p = b.getPosition();
- double velocityX = b.getVelocityX();
- double velocityY = b.getVelocityY();
-
- if (b.getType() == BulletType.Acid_Spore) bulletTypeName = "Acid_Spore";
- else if (b.getType() == BulletType.Anti_Matter_Missile) bulletTypeName = "Anti_Matter_Missile";
- else if (b.getType() == BulletType.Arclite_Shock_Cannon_Hit) bulletTypeName = "Arclite_Shock_Cannon_Hit";
- else if (b.getType() == BulletType.ATS_ATA_Laser_Battery) bulletTypeName = "ATS_ATA_Laser_Battery";
- else if (b.getType() == BulletType.Burst_Lasers) bulletTypeName = "Burst_Lasers";
- else if (b.getType() == BulletType.C_10_Canister_Rifle_Hit) bulletTypeName = "C_10_Canister_Rifle_Hit";
- else if (b.getType() == BulletType.Consume) bulletTypeName = "Consume";
- else if (b.getType() == BulletType.Corrosive_Acid_Shot) bulletTypeName = "Corrosive_Acid_Shot";
- else if (b.getType() == BulletType.Dual_Photon_Blasters_Hit) bulletTypeName = "Dual_Photon_Blasters_Hit";
- else if (b.getType() == BulletType.EMP_Missile) bulletTypeName = "EMP_Missile";
- else if (b.getType() == BulletType.Ensnare) bulletTypeName = "Ensnare";
- else if (b.getType() == BulletType.Fragmentation_Grenade) bulletTypeName = "Fragmentation_Grenade";
- else if (b.getType() == BulletType.Fusion_Cutter_Hit) bulletTypeName = "Fusion_Cutter_Hit";
- else if (b.getType() == BulletType.Gauss_Rifle_Hit) bulletTypeName = "Gauss_Rifle_Hit";
- else if (b.getType() == BulletType.Gemini_Missiles) bulletTypeName = "Gemini_Missiles";
- else if (b.getType() == BulletType.Glave_Wurm) bulletTypeName = "Glave_Wurm";
- else if (b.getType() == BulletType.Halo_Rockets) bulletTypeName = "Halo_Rockets";
- else if (b.getType() == BulletType.Invisible) bulletTypeName = "Invisible";
- else if (b.getType() == BulletType.Longbolt_Missile) bulletTypeName = "Longbolt_Missile";
- else if (b.getType() == BulletType.Melee) bulletTypeName = "Melee";
- else if (b.getType() == BulletType.Needle_Spine_Hit) bulletTypeName = "Needle_Spine_Hit";
- else if (b.getType() == BulletType.Neutron_Flare) bulletTypeName = "Neutron_Flare";
- else if (b.getType() == BulletType.None) bulletTypeName = "None";
- else if (b.getType() == BulletType.Optical_Flare_Grenade) bulletTypeName = "Optical_Flare_Grenade";
- else if (b.getType() == BulletType.Particle_Beam_Hit) bulletTypeName = "Particle_Beam_Hit";
- else if (b.getType() == BulletType.Phase_Disruptor) bulletTypeName = "Phase_Disruptor";
- else if (b.getType() == BulletType.Plague_Cloud) bulletTypeName = "Plague_Cloud";
- else if (b.getType() == BulletType.Psionic_Shockwave_Hit) bulletTypeName = "Psionic_Shockwave_Hit";
- else if (b.getType() == BulletType.Psionic_Storm) bulletTypeName = "Psionic_Storm";
- else if (b.getType() == BulletType.Pulse_Cannon) bulletTypeName = "Pulse_Cannon";
- else if (b.getType() == BulletType.Queen_Spell_Carrier) bulletTypeName = "Queen_Spell_Carrier";
- else if (b.getType() == BulletType.Seeker_Spores) bulletTypeName = "Seeker_Spores";
- else if (b.getType() == BulletType.STA_STS_Cannon_Overlay) bulletTypeName = "STA_STS_Cannon_Overlay";
- else if (b.getType() == BulletType.Subterranean_Spines) bulletTypeName = "Subterranean_Spines";
- else if (b.getType() == BulletType.Sunken_Colony_Tentacle) bulletTypeName = "Sunken_Colony_Tentacle";
- else if (b.getType() == BulletType.Unknown) bulletTypeName = "Unknown";
- else if (b.getType() == BulletType.Yamato_Gun) bulletTypeName = "Yamato_Gun";
-
- // 아군 것이면 녹색, 적군 것이면 빨간색
- Broodwar.drawLineMap(p, new Position(p.getX() + (int) velocityX, p.getY() + (int) velocityY), b.getPlayer() == Broodwar.self() ? Color.Green : Color.Red);
- if (b.getType() != null) {
- Broodwar.drawTextMap(p, (b.getPlayer() == Broodwar.self() ? "" + UxColor.CHAR_TEAL : "" + UxColor.CHAR_RED) + bulletTypeName);
- }
- }
- }
-
- private void drawSquadUnitTagMap() {
- // draw neutral units and our units
- for (Squad squad : CombatManager.Instance().squadData.getSquadMap().values()) {
- Color color = UxColor.SQUAD_COLOR.get(squad.getClass());
- if (color == null) {
- continue;
- }
- String squadName = squad.getSquadName();
-
- StrategyCode.SmallFightPredict smallFightPredict = null;
- if (squad instanceof WatcherSquad) {
- smallFightPredict = ((WatcherSquad) squad).getSmallFightPredict();
- }
-
- if (squadName.length() > 4) {
- squadName = squadName.substring(0, 4);
- }
-
- for (Unit unit : squad.unitList) {
- Broodwar.drawCircleMap(unit.getPosition(), 10, color);
- Broodwar.drawTextMap(unit.getPosition().getX() - 20, unit.getPosition().getY() - 30, squadName);
- if (smallFightPredict != null && smallFightPredict == StrategyCode.SmallFightPredict.BACK) {
- Broodwar.drawTextMap(unit.getPosition().getX() - 20, unit.getPosition().getY() - 15, UxColor.CHAR_RED + smallFightPredict.toString());
- }
- }
-
-// Map checkerSiteMap = VultureTravelManager.Instance().getCheckerSiteMap2();
-// List baseList = VultureTravelManager.Instance().getBaseLocationsCheckerOrdered();
-// for (Integer checkerId : checkerSiteMap.keySet()) {
-// Unit unit = Broodwar.getUnit(checkerId);
-// if (UnitUtils.isValidUnit(unit)) {
-// Integer index = checkerSiteMap.get(checkerId);
-// if (index != null) {
-// Broodwar.drawTextMap(unit.getPosition().getX() - 20, unit.getPosition().getY() - 5, UxColor.CHAR_ORANGE + baseList.get(index).getPosition().toString());
-// }
-//
-// }
-// }
- }
- }
-
- private void drawSquadInfoOnMap(int x, int y) {
- /// ConstructionQueue 를 Screen 에 표시합니다
- Broodwar.drawTextScreen(x, y, UxColor.CHAR_WHITE + "");
- Broodwar.drawTextScreen(x + 110, y, UxColor.CHAR_WHITE + " ");
-
- y += 15;
- Broodwar.drawTextScreen(x, y, "" + "*" + "SCV");
- Broodwar.drawTextScreen(x + 120, y, "" + UnitUtils.getUnitCount(UnitFindStatus.COMPLETE, UnitType.Terran_SCV));
- y += 10;
- for (Squad squad : CombatManager.Instance().squadData.getSquadMap().values()) {
- Color squadColor = UxColor.SQUAD_COLOR.get(squad.getClass());
- if (squadColor != null) {
- Broodwar.drawTextScreen(x, y, "" + UxColor.COLOR_TO_CHARACTER.get(squadColor) + squad.getSquadName());
- } else {
- Broodwar.drawTextScreen(x, y, "" + "*" + squad.getSquadName());
- }
- String unitIds = " ... ";
- for (Unit unit : squad.unitList) {
- unitIds = unitIds + unit.getID() + "/";
- }
- Broodwar.drawTextScreen(x + 120, y, "" + squad.unitList.size() + unitIds);
- y += 10;
- }
- }
-
- private void drawManagerTimeSpent(int x, int y) {
- List gameManagers = Arrays.asList(
- //InformationManager.Instance(),
- StrategyManager.Instance(),
- MapGrid.Instance(),
- BuildManager.Instance(),
- BuildQueueProvider.Instance(),
- ConstructionManager.Instance(),
- WorkerManager.Instance(),
- CombatManager.Instance()
-// AttackDecisionMaker.Instance()
- );
-
-
- int currentY = y;
- for (GameManager gameManager : gameManagers) {
- currentY += 10;
- Broodwar.drawTextScreen(x, currentY, UxColor.CHAR_PURPLE + gameManager.getClass().getSimpleName());
-
- char drawColor = UxColor.CHAR_WHITE;
- if (gameManager.getRecorded() > 10L) {
- drawColor = UxColor.CHAR_TEAL;
- } else if (gameManager.getRecorded() > 30L) {
- drawColor = UxColor.CHAR_RED;
- }
- Broodwar.drawTextScreen(x + 103, currentY, ": " + drawColor + gameManager.getRecorded());
- }
-
- Broodwar.drawTextScreen(x, currentY += 15, "* group size: " + LagObserver.groupsize());
- Broodwar.drawTextScreen(x, currentY += 10, "* manager rotation size: " + LagObserver.managerRotationSize());
- }
-
- private void drawBigWatch() {
- Map resultTimeMap = BigWatch.getResultTimeMap();
- Map recordTimeMap = BigWatch.getRecordTimeMap();
-
- List tags = new ArrayList<>(recordTimeMap.keySet());
- Collections.sort(tags);
-
- int currentY = 0;
- for (String tag : tags) {
- Long resultTime = resultTimeMap.get(tag);
- resultTime = resultTime == null ? 0L : resultTime;
- Long recordTime = recordTimeMap.get(tag);
-
- char drawColor = UxColor.CHAR_WHITE;
- if (recordTime > 10L) {
- drawColor = UxColor.CHAR_TEAL;
- } else if (recordTime > 30L) {
- drawColor = UxColor.CHAR_RED;
- }
- Broodwar.drawTextScreen(10, currentY += 10, UxColor.CHAR_WHITE + tag + " : " + resultTime + " / " + drawColor + recordTime);
- }
- }
-
- private void drawPathData() {
- for (Unit depot : UnitUtils.getUnitList(UnitType.Terran_Command_Center)) {
- List mineralsList = WorkerData.depotMineral.get(depot);
- if (mineralsList == null) {
-// System.out.println("mineralsList is null.");
-// if (depot != null) {
-// System.out.println("depot=" + depot.getID() + "" + depot.getPosition());
-// } else {
-// System.out.println("depot is null");
-// }
- return;
- }
-
- for (Minerals minr : mineralsList) {
- if (minr.mineralTrick != null) {
- Broodwar.drawCircleMap(minr.mineralUnit.getPosition().getX(), minr.mineralUnit.getPosition().getY(), 4, Color.Blue, true);
- Broodwar.drawCircleMap(minr.mineralTrick.getPosition().getX(), minr.mineralTrick.getPosition().getY(), 4, Color.Purple, true);
- }
- }
-
-
- for (Minerals minr : WorkerData.depotMineral.get(depot)) {
- if (minr.posTrick != bwapi.Position.None) {
- Broodwar.drawCircleMap(minr.posTrick.getX(), minr.posTrick.getY(), 4, Color.Red, true);
- Broodwar.drawCircleMap(minr.mineralUnit.getPosition().getX(), minr.mineralUnit.getPosition().getY(), 4, Color.Yellow, true);
- }
- }
-
- //Broodwar->drawCircleMap(Minerals[0].posTrick.x(),Minerals[0].posTrick.y(),2,Colors::Purple,true);
-
- //Prebot.Broodwar.drawCircleMap(Mineral.Instance().CCtrick.getX(),Mineral.Instance().CCtrick.getY(),2,Color.Brown,true);
- //for(int i=0; i< MineralManager.Instance().minerals.size(); i++){
- //Prebot.Broodwar.drawTextMap( minr.mineral.getPosition().getX(),minr.mineral.getPosition().getY(), "(" + (int)(MineralManager.Instance().minerals.get(i).MinToCC) + (int)(MineralManager.Instance().minerals.get(i).CCToMin) + ")");
- //}
- }
-
- }
-
- private void drawStrategy() {
- String upgradeString = "";
- for (MetaType metaType : StrategyBoard.upgrade) {
- upgradeString += metaType.getName() + " > ";
- }
-
- int y = 10;
- Race enemyRace = PlayerUtils.enemyRace();
- EnemyStrategy strategy = StrategyBoard.currentStrategy;
- int phase = EnemyStrategyAnalyzer.Instance().getPhase();
-
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "[" + strategy.name() + " ...(phase " + phase + ")]");
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "FAC RATIO : " + StrategyBoard.factoryRatio + ".. (" + UnitUtils.myFactoryUnitSupplyCount() + ")");
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "UPGRADE : " + upgradeString);
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "MARINE CNT : " + StrategyBoard.marineCount);
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "ADDON : " + StrategyBoard.addOnOption);
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "EXPANSION : " + StrategyBoard.expansionOption);
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "WRAITH CNT : " + StrategyBoard.wraithCount);
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "VALKYRIE CNT : " + StrategyBoard.valkyrieCount);
- Broodwar.drawTextScreen(20, y += 12, UxColor.CHAR_YELLOW + "MISSION : " + strategy.missionTypeList);
- Broodwar.drawTextScreen(20, y += 20, UxColor.CHAR_YELLOW + "" + strategy.buildTimeMap);
-
- Broodwar.drawTextScreen(20, 260, "" + UxColor.CHAR_YELLOW + ClueManager.Instance().getClueInfoList());
-
- y = 10;
- for (EnemyStrategy enemyStrategy : EnemyStrategy.values()) {
- if (enemyStrategy.name().startsWith(enemyRace.toString().toUpperCase())) {
- Broodwar.drawTextScreen(400, y += 10, "" + UxColor.CHAR_YELLOW + enemyStrategy.name());
- }
- }
- }
-
- private void drawEnemyAirDefenseRange() {
- List airDefenseEuiList = UnitUtils.getEnemyUnitInfoList(EnemyUnitVisibleStatus.ALL, UnitTypeUtils.enemyAirDefenseUnitType());
- for (UnitInfo eui : airDefenseEuiList) {
- if (eui.getType() == UnitType.Terran_Bunker) {
- Broodwar.drawCircleMap(eui.getLastPosition(), Broodwar.enemy().weaponMaxRange(UnitType.Terran_Marine.groundWeapon()) + 96, Color.White);
- } else {
- Broodwar.drawCircleMap(eui.getLastPosition(), eui.getType().airWeapon().maxRange(), Color.White);
- }
- }
- List wraithKillerEuiList = UnitUtils.getEnemyUnitInfoList(EnemyUnitVisibleStatus.ALL, UnitTypeUtils.wraithKillerUnitType());
- for (UnitInfo eui : wraithKillerEuiList) {
- Broodwar.drawCircleMap(eui.getLastPosition(), eui.getType().airWeapon().maxRange(), Color.Grey);
- }
- }
-
- private void drawAirForceInformation() {
- // wraith moving
- for (Unit unit : UnitUtils.getUnitList(UnitType.Terran_Wraith)) {
- if (unit.isMoving()) {
- Broodwar.drawCircleMap(unit.getPosition(), dotRadius, Color.Orange, true);
- Broodwar.drawCircleMap(unit.getTargetPosition(), dotRadius, Color.Orange, true);
- Broodwar.drawLineMap(unit.getPosition(), unit.getTargetPosition(), Color.Orange);
- }
- }
-
- // target position
- List targetPositions = AirForceManager.Instance().getTargetPositions();
- for (int i = 0; i < targetPositions.size(); i++) {
- Broodwar.drawTextMap(targetPositions.get(i), "position#" + i);
- }
-
- // air force team
- int y = 190;
- Set airForceTeamSet = new HashSet<>(AirForceManager.Instance().getAirForceTeamMap().values());
- List airForceList = new ArrayList<>(airForceTeamSet);
- airForceList.sort(new Comparator() {
- @Override
- public int compare(AirForceTeam a1, AirForceTeam a2) {
- int memberGap = a1.memberList.size() - a2.memberList.size();
- int idGap = a1.leaderUnit.getID() - a2.leaderUnit.getID();
- return memberGap * 100 + idGap;
- }
- });
- for (AirForceTeam airForceTeam : airForceList) {
- char color = UxColor.CHAR_WHITE;
- if (airForceTeam.repairCenter != null) {
- color = UxColor.CHAR_RED;
- }
- Position position = airForceTeam.leaderUnit.getPosition();
- Broodwar.drawTextMap(position.getX(), position.getY() - 10, color + "leader#" + airForceTeam.leaderUnit.getID());
-
- Position targetPosition = new Position(airForceTeam.getTargetPosition().getX(), airForceTeam.getTargetPosition().getY() - 10);
- Broodwar.drawTextMap(targetPosition, UxColor.CHAR_RED + "*" + airForceTeam.leaderUnit.getID());
- Broodwar.drawTextScreen(20, y += 15, "" + UxColor.CHAR_YELLOW + airForceTeam.toString());
- }
- Broodwar.drawTextScreen(20, y += 15, "Defense Mode? " + AirForceManager.Instance().isAirForceDefenseMode());
- Broodwar.drawTextScreen(20, y += 15, "strike level=" + AirForceManager.Instance().getStrikeLevel());
- Broodwar.drawTextScreen(20, y += 15, "total achievement=" + AirForceManager.Instance().getAchievementEffectiveFrame());
- Broodwar.drawTextScreen(20, y += 15, "accumulated achievement=" + AirForceManager.Instance().getAccumulatedAchievement());
- Broodwar.drawTextScreen(20, y += 15, "wraith count=" + StrategyBoard.wraithCount);
- }
-
- private void drawVulturePolicy() {
- int y = 10;
- Broodwar.drawTextScreen(400, y += 15, "[vulture policy]");
- Broodwar.drawTextScreen(400, y += 15, "checkerMaxNumber=" + StrategyBoard.checkerMaxNumber);
- Broodwar.drawTextScreen(400, y += 15, "spiderMineNumberPerPosition=" + StrategyBoard.spiderMineNumberPerPosition);
- Broodwar.drawTextScreen(400, y += 15, "spiderMineNumberPerGoodPosition=" + StrategyBoard.spiderMineNumberPerGoodPosition);
- Broodwar.drawTextScreen(400, y += 15, "watcherMinePositionLevel=" + StrategyBoard.watcherMinePositionLevel);
- }
-
- private void drawEnemyBaseToBaseTime() {
- int y = 0;
- Broodwar.drawTextScreen(10, y += 15, "campPosition : " + StrategyBoard.campPosition + " / " + StrategyBoard.campType);
- Broodwar.drawTextScreen(10, y += 15, "mainPosition : " + StrategyBoard.mainPosition);
- Broodwar.drawTextScreen(10, y += 15, "watcherPosition : " + StrategyBoard.watcherPosition);
- Broodwar.drawTextScreen(10, y += 15, "mainSquadCenter : " + StrategyBoard.mainSquadCenter);
- Broodwar.drawTextScreen(10, y += 15, "enemyGroundSquadPosition : " + StrategyBoard.nearGroundEnemyPosition + " / " + StrategyBoard.enemyUnitStatus);
- Broodwar.drawTextScreen(10, y += 15, "enemyAirSquadPosition : " + StrategyBoard.nearAirEnemyPosition);
- Broodwar.drawTextScreen(10, y += 15, "enemyDropEnemyPosition : " + StrategyBoard.dropEnemyPosition);
-
- y += 10;
- Position enemyBasePosition = null;
- Position enemyExpansionPosition = null;
- if (BaseUtils.enemyMainBase() != null) {
- enemyBasePosition = BaseUtils.enemyMainBase().getPosition();
- enemyExpansionPosition = BaseUtils.enemyMainBase().getPosition();
-
- }
- Broodwar.drawTextScreen(10, y += 15, "enemyMainBase : " + enemyBasePosition);
- Broodwar.drawTextScreen(10, y += 15, "enemyFirstExpansion : " + enemyExpansionPosition);
-
-// if (StrategyBoard.enemyBaseExpected != null) {
-// Broodwar.drawTextScreen(10, y += 15, "enemyMainBase (Expect) : " + StrategyBoard.enemyBaseExpected.getPosition());
-// }
-// for (Entry unitType : InformationManager.Instance().baseToBaseUnit.entrySet()) {
-// Prebot.Broodwar.drawTextScreen(20, y += 10, "" + UxColor.CHAR_YELLOW + unitType.getKey() + " : " + unitType.getValue());
-// }
- }
-
- private void drawPositionInformation() {
-
- if (StrategyBoard.mainSquadLeaderPosition != null) {
- Broodwar.drawTextMap(DrawingUtils.positionAdjusted(StrategyBoard.mainSquadLeaderPosition, 0, -20), UxColor.CHAR_WHITE + "V");
- }
- if (StrategyBoard.campPosition.equals(StrategyBoard.mainPosition)) {
- Broodwar.drawTextMap(StrategyBoard.campPosition, UxColor.CHAR_ORANGE + "camp & main");
- } else {
- if (StrategyBoard.campPosition != null) {
- Broodwar.drawTextMap(StrategyBoard.campPosition, UxColor.CHAR_YELLOW + "camp");
- }
- if (StrategyBoard.mainPosition != null) {
- Broodwar.drawTextMap(DrawingUtils.positionAdjusted(StrategyBoard.mainPosition, 0, -10), UxColor.CHAR_RED + "main");
- }
- }
- if (StrategyBoard.campPositionSiege != null) {
- Broodwar.drawTextMap(StrategyBoard.campPositionSiege, UxColor.CHAR_YELLOW + "camp (siege)");
- }
- if (StrategyBoard.watcherPosition != null) {
- Broodwar.drawTextMap(DrawingUtils.positionAdjusted(StrategyBoard.watcherPosition, 0, -20), UxColor.CHAR_BLUE + "watcherPos");
- }
- if (StrategyBoard.mainSquadCenter != null) {
- Broodwar.drawTextMap(StrategyBoard.mainSquadCenter, "mainSqCntr");
- Broodwar.drawCircleMap(StrategyBoard.mainSquadCenter.getX(), StrategyBoard.mainSquadCenter.getY(), StrategyBoard.mainSquadCoverRadius, Color.Cyan);
- }
- if (StrategyBoard.nearGroundEnemyPosition != null) {
- Broodwar.drawTextMap(StrategyBoard.nearGroundEnemyPosition, UxColor.CHAR_RED + "nearEnemySq(Ground)");
- Broodwar.drawCircleMap(StrategyBoard.nearGroundEnemyPosition, 150, Color.Red);
- }
- if (StrategyBoard.nearAirEnemyPosition != null) {
- Broodwar.drawTextMap(StrategyBoard.nearAirEnemyPosition, UxColor.CHAR_RED + "nearEnemySq(Air)");
- Broodwar.drawCircleMap(StrategyBoard.nearAirEnemyPosition, 150, Color.Red);
- }
- if (StrategyBoard.dropEnemyPosition != null) {
- Broodwar.drawTextMap(StrategyBoard.dropEnemyPosition, UxColor.CHAR_RED + "dropEnemySq");
- Broodwar.drawCircleMap(StrategyBoard.dropEnemyPosition, 150, Color.Red);
- }
- if (StrategyBoard.totalEnemyCneterPosition != null) {
- Broodwar.drawTextMap(StrategyBoard.totalEnemyCneterPosition, "totalEnemySq");
- Broodwar.drawCircleMap(StrategyBoard.totalEnemyCneterPosition, 250, Color.Red);
- }
- if (PositionUtils.myReadyToPosition() != null) {
- Broodwar.drawTextMap(PositionUtils.myReadyToPosition(), "myReadyTo");
- }
- if (PositionUtils.enemyReadyToPosition() != null) {
- Broodwar.drawTextMap(PositionUtils.enemyReadyToPosition(), "enemyReadyTo");
- }
-// if (VultureTravelManager.Instance().getTravelSites() != null) {
-// for (TravelSite site : VultureTravelManager.Instance().getTravelSites()) {
-// Broodwar.drawTextMap(site.baseLocation.getPosition(), "travel site\n" + site);
-// }
-// }
- }
-
- private void drawCCtoScvCount() {
-
- int y = 100;
- for (Unit depot : UnitUtils.getCompletedUnitList(UnitType.Terran_Command_Center)) {
- // update workerData with the new job
- Broodwar.drawTextScreen(500, y, "depot.getID() : " + depot.getID() + " cnt : " + WorkerData.depotWorkerCount.get(depot.getID()));
- y += 10;
- }
- }
-
- /// turret 건설 지점의 반경 표시
- public void drawTurretMap() {
- BaseLocation myBase = BaseUtils.myMainBase();
- BaseLocation myFirstExpansion = BaseUtils.myFirstExpansion();
- Chokepoint myFirstChoke = ChokeUtils.myFirstChoke();
- Chokepoint mySecondChoke = ChokeUtils.mySecondChoke();
-
- int turretCount = UnitUtils.getCompletedUnitCount(UnitType.Terran_Missile_Turret);
-
- Position firstChokeMainHalf = new Position((myBase.getPosition().getX() + myFirstChoke.getX() * 2) / 3 - 60,
- (myBase.getPosition().getY() + myFirstChoke.getY() * 2) / 3 - 60);
-
- Position firstChokeExpHalf = new Position((myFirstExpansion.getPosition().getX() * 2 + myFirstChoke.getX()) / 3,
- (myFirstExpansion.getPosition().getY() * 2 + myFirstChoke.getY()) / 3);
-
-//// Position betweenChoke = new Position((myFirstChoke.getX() * 2 + myFirstChoke.getX()) / 3,
-//// (mySecondChoke.getY() * 2 + mySecondChoke.getY()) / 3);
-////
-
-// Broodwar.drawTextMap(firstChokeExpHalf.getX() + 20, firstChokeExpHalf.getY() + 10, "(" + (int) (firstChokeExpHalf.getX()) + ", " + (int) (firstChokeExpHalf.getY()) + ")");
-//
-// Broodwar.drawCircleMap(firstChokeExpHalf, 150, Color.Orange, false);
-//
-// Broodwar.drawCircleMap(firstChokeExpHalf, 150 + turretCount * 15, Color.Orange, false);
-//
-// Broodwar.drawTextMap(mySecondChoke.getCenter().getX() + 20, mySecondChoke.getCenter().getY() + 10, "(" + (int) (mySecondChoke.getCenter().getX()) + ", " + (int) (mySecondChoke.getCenter().getY()) + ")");
-//
-// Broodwar.drawCircleMap(mySecondChoke.getCenter(), 150, Color.Cyan, false);
-//
-// Broodwar.drawCircleMap(mySecondChoke.getCenter(), 150 + turretCount * 15, Color.Cyan, false);
-//
-// Position betweenChoke2 = Position.None;
-//
-// if (MapUtils.getMapSpecificInformation().getMap() == GameMap.FIGHTING_SPIRITS) {
-// betweenChoke2 = new Position((firstChokeMainHalf.getX() * 4 + mySecondChoke.getX() * 7) / 11,
-// (firstChokeMainHalf.getY() * 4 + mySecondChoke.getY() * 7) / 11);
-// }else {
-// betweenChoke2 = new Position((firstChokeMainHalf.getX() * 3 + mySecondChoke.getX() * 4) / 7,
-// (firstChokeMainHalf.getY() * 4 + mySecondChoke.getY() * 7) / 11);
-// }
-//
-//// Position betweenChoke2 = new Position((firstChokeMainHalf.getX() * 4 + mySecondChoke.getX() * 7) / 11,
-//// (firstChokeMainHalf.getY() * 4 + mySecondChoke.getY() * 7) / 11);
-//
-// Broodwar.drawTextMap(betweenChoke2.getX() + 20, betweenChoke2.getY() + 10, "(" + (int) (betweenChoke2.getX()) + ", " + (int) (betweenChoke2.getY()) + ")");
-//
-// Broodwar.drawCircleMap(betweenChoke2, 120, Color.White, false);
-//
-// Broodwar.drawCircleMap(betweenChoke2, 120 + turretCount * 15, Color.White, false);
-//
-//// radius1 + turretCount * 15
-
- }
+ String squadName = squad.getSquadName();
+ StrategyCode.SmallFightPredict smallFightPredict = null;
+ if (squad instanceof WatcherSquad) {
+ smallFightPredict = ((WatcherSquad) squad).getSmallFightPredict();
+ }
+
+ if (squadName.length() > 4) {
+ squadName = squadName.substring(0, 4);
+ }
+
+ for (Unit unit : squad.unitList) {
+ Broodwar.drawCircleMap(unit.getPosition(), 10, color);
+ Broodwar.drawTextMap(unit.getPosition().getX() - 20, unit.getPosition().getY() - 30, squadName);
+ if (smallFightPredict != null && smallFightPredict == StrategyCode.SmallFightPredict.BACK) {
+ Broodwar.drawTextMap(unit.getPosition().getX() - 20, unit.getPosition().getY() - 15,
+ UxColor.CHAR_RED + smallFightPredict.toString());
+ }
+ }
+
+ }
+ }
+
+ /*
+ * private void drawSquadInfoOnMap() { /// ConstructionQueue 를 Screen 에
+ * 표시합니다 uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L",""," "
+ * ,UxColor.CHAR_WHITE); drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * uxDrawConfig = UxDrawConfig.newInstanceObjectType("L","" + "*" +
+ * "SCV"," "+ UnitUtils.getUnitCount(UnitFindStatus.COMPLETE,
+ * UnitType.Terran_SCV),UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * for (Squad squad :
+ * CombatManager.Instance().squadData.getSquadMap().values()) { Color
+ * squadColor = UxColor.SQUAD_COLOR.get(squad.getClass()); String squadName
+ * = ""; if (squadColor != null) { squadName = "" +
+ * UxColor.COLOR_TO_CHARACTER.get(squadColor) + squad.getSquadName(); } else
+ * { squadName = "*" + squad.getSquadName(); } String unitIds = " ... "; for
+ * (Unit unit : squad.unitList) { unitIds = unitIds + unit.getID() + "/"; }
+ * uxDrawConfig = UxDrawConfig.newInstanceObjectType("L",squadName," "+ ""
+ * + squad.unitList.size() + unitIds,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig); } }
+ */
+
+ protected void drawManagerTimeSpent() {
+ List gameManagers = Arrays.asList(
+ // InformationManager.Instance(),
+ StrategyManager.Instance(), MapGrid.Instance(), BuildManager.Instance(), BuildQueueProvider.Instance(),
+ ConstructionManager.Instance(), WorkerManager.Instance(), CombatManager.Instance()
+ // AttackDecisionMaker.Instance()
+ );
+
+ for (GameManager gameManager : gameManagers) {
+ char drawColor = UxColor.CHAR_WHITE;
+ if (gameManager.getRecorded() > 10L) {
+ drawColor = UxColor.CHAR_TEAL;
+ } else if (gameManager.getRecorded() > 30L) {
+ drawColor = UxColor.CHAR_RED;
+ }
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("R", gameManager.getClass().getSimpleName(),
+ gameManager.getRecorded(), UxColor.CHAR_PURPLE);
+ drawStrategyRightList.add(uxDrawConfig);
+ }
+
+ uxDrawConfig = UxDrawConfig.newInstanceMethodType("R", "* group size", LagObserver.class, "groupsize",
+ UxColor.CHAR_WHITE);
+ drawStrategyRightList.add(uxDrawConfig);
+ uxDrawConfig = UxDrawConfig.newInstanceMethodType("R", "* manager rotation size", LagObserver.class,
+ "managerRotationSize", UxColor.CHAR_WHITE);
+ drawStrategyRightList.add(uxDrawConfig);
+ }
+
+ /*
+ * private void drawBigWatch() { Map resultTimeMap =
+ * BigWatch.getResultTimeMap(); Map recordTimeMap =
+ * BigWatch.getRecordTimeMap();
+ *
+ * List tags = new ArrayList<>(recordTimeMap.keySet());
+ * Collections.sort(tags);
+ *
+ * for (String tag : tags) { Long resultTime = resultTimeMap.get(tag);
+ * resultTime = resultTime == null ? 0L : resultTime; Long recordTime =
+ * recordTimeMap.get(tag);
+ *
+ * char drawColor = UxColor.CHAR_WHITE; if (recordTime > 10L) { drawColor =
+ * UxColor.CHAR_TEAL; } else if (recordTime > 30L) { drawColor =
+ * UxColor.CHAR_RED; } uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","",tag + " : " + resultTime +
+ * " / " + drawColor + recordTime,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig); } }
+ */
+
+ protected void drawPathData() {
+ for (Unit depot : UnitUtils.getUnitList(UnitType.Terran_Command_Center)) {
+ List mineralsList = WorkerData.depotMineral.get(depot);
+ if (mineralsList == null) {
+ return;
+ }
+
+ for (Minerals minr : mineralsList) {
+ if (minr.mineralTrick != null) {
+ Broodwar.drawCircleMap(minr.mineralUnit.getPosition().getX(), minr.mineralUnit.getPosition().getY(),
+ 4, Color.Blue, true);
+ Broodwar.drawCircleMap(minr.mineralTrick.getPosition().getX(),
+ minr.mineralTrick.getPosition().getY(), 4, Color.Purple, true);
+ }
+ }
+
+ for (Minerals minr : WorkerData.depotMineral.get(depot)) {
+ if (minr.posTrick != bwapi.Position.None) {
+ Broodwar.drawCircleMap(minr.posTrick.getX(), minr.posTrick.getY(), 4, Color.Red, true);
+ Broodwar.drawCircleMap(minr.mineralUnit.getPosition().getX(), minr.mineralUnit.getPosition().getY(),
+ 4, Color.Yellow, true);
+ }
+ }
+
+ }
+
+ }
+
+ protected void drawStrategy() {
+ String upgradeString = "";
+ for (MetaType metaType : StrategyBoard.upgrade) {
+ upgradeString += metaType.getName() + " > ";
+ }
+
+ Race enemyRace = PlayerUtils.enemyRace();
+ EnemyStrategy strategy = StrategyBoard.currentStrategy;
+ int phase = EnemyStrategyAnalyzer.Instance().getPhase();
+
+ // setting
+ UxDrawConfig uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "",
+ "[" + strategy.name() + " ...(phase " + phase + ")]", UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "UPGRADE", upgradeString, UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "EXPANSION", StrategyBoard.expansionOption,
+ UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "MISSION", strategy.missionTypeList, UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", ClueManager.Instance().getClueInfoList(),
+ UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "", strategy.buildTimeMap, UxColor.CHAR_WHITE);
+ drawStrategyLeftList.add(uxDrawConfig);
+
+ for (EnemyStrategy enemyStrategy : EnemyStrategy.values()) {
+ if (enemyStrategy.name().startsWith(enemyRace.toString().toUpperCase())) {
+ uxDrawConfig = UxDrawConfig.newInstanceStringType("R", "", enemyStrategy.name(), UxColor.CHAR_YELLOW);
+ drawStrategyRightList.add(uxDrawConfig);
+ }
+ }
+ }
+
+ private void drawEnemyAirDefenseRange() {
+ List airDefenseEuiList = UnitUtils.getEnemyUnitInfoList(EnemyUnitVisibleStatus.ALL,
+ UnitTypeUtils.enemyAirDefenseUnitType());
+ for (UnitInfo eui : airDefenseEuiList) {
+ if (eui.getType() == UnitType.Terran_Bunker) {
+ Broodwar.drawCircleMap(eui.getLastPosition(),
+ Broodwar.enemy().weaponMaxRange(UnitType.Terran_Marine.groundWeapon()) + 96, Color.White);
+ } else {
+ Broodwar.drawCircleMap(eui.getLastPosition(), eui.getType().airWeapon().maxRange(), Color.White);
+ }
+ }
+ List wraithKillerEuiList = UnitUtils.getEnemyUnitInfoList(EnemyUnitVisibleStatus.ALL,
+ UnitTypeUtils.wraithKillerUnitType());
+ for (UnitInfo eui : wraithKillerEuiList) {
+ Broodwar.drawCircleMap(eui.getLastPosition(), eui.getType().airWeapon().maxRange(), Color.Grey);
+ }
+ }
+
+ private void drawAirForceInformation() {
+ // wraith moving
+ for (Unit unit : UnitUtils.getUnitList(UnitType.Zerg_Mutalisk)) {
+ if (unit.isMoving()) {
+ Broodwar.drawCircleMap(unit.getPosition(), dotRadius, Color.Orange, true);
+ Broodwar.drawCircleMap(unit.getTargetPosition(), dotRadius, Color.Orange, true);
+ Broodwar.drawLineMap(unit.getPosition(), unit.getTargetPosition(), Color.Orange);
+ }
+ }
+
+ // target position
+ List targetPositions = AirForceManager.Instance().getTargetPositions();
+ for (int i = 0; i < targetPositions.size(); i++) {
+ Broodwar.drawTextMap(targetPositions.get(i), "position#" + i);
+ }
+
+ // air force team
+ int y = 190;
+ Set airForceTeamSet = new HashSet<>(AirForceManager.Instance().getAirForceTeamMap().values());
+ List airForceList = new ArrayList<>(airForceTeamSet);
+ airForceList.sort(new Comparator() {
+ @Override
+ public int compare(AirForceTeam a1, AirForceTeam a2) {
+ int memberGap = a1.memberList.size() - a2.memberList.size();
+ int idGap = a1.leaderUnit.getID() - a2.leaderUnit.getID();
+ return memberGap * 100 + idGap;
+ }
+ });
+ for (AirForceTeam airForceTeam : airForceList) {
+ char color = UxColor.CHAR_WHITE;
+ if (airForceTeam.repairCenter != null) {
+ color = UxColor.CHAR_RED;
+ }
+ Position position = airForceTeam.leaderUnit.getPosition();
+ Broodwar.drawTextMap(position.getX(), position.getY() - 10,
+ color + "leader#" + airForceTeam.leaderUnit.getID());
+
+ Position targetPosition = new Position(airForceTeam.getTargetPosition().getX(),
+ airForceTeam.getTargetPosition().getY() - 10);
+ Broodwar.drawTextMap(targetPosition, UxColor.CHAR_RED + "*" + airForceTeam.leaderUnit.getID());
+ Broodwar.drawTextScreen(L, y += 15, "" + UxColor.CHAR_YELLOW + airForceTeam.toString());
+ }
+
+ }
+
+ /*
+ * private void drawEnemyBaseToBaseTime() { uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","campPosition : " +
+ * StrategyBoard.campPosition + " / " +
+ * StrategyBoard.campType,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","mainPosition : " +
+ * StrategyBoard.mainPosition,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","watcherPosition : " +
+ * StrategyBoard.watcherPosition,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","mainSquadCenter : " +
+ * StrategyBoard.mainSquadCenter,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","enemyGroundSquadPosition : " +
+ * StrategyBoard.nearGroundEnemyPosition + " / " +
+ * StrategyBoard.enemyUnitStatus,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","enemyAirSquadPosition : " +
+ * StrategyBoard.nearAirEnemyPosition,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","enemyDropEnemyPosition : " +
+ * StrategyBoard.dropEnemyPosition,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * Position enemyBasePosition = null; Position enemyExpansionPosition =
+ * null; if (BaseUtils.enemyMainBase() != null) { enemyBasePosition =
+ * BaseUtils.enemyMainBase().getPosition(); enemyExpansionPosition =
+ * BaseUtils.enemyMainBase().getPosition();
+ *
+ * } uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","enemyMainBase : " +
+ * enemyBasePosition,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig);
+ *
+ * uxDrawConfig =
+ * UxDrawConfig.newInstanceObjectType("L","","enemyFirstExpansion : " +
+ * enemyExpansionPosition,UxColor.CHAR_WHITE);
+ * drawStrategyLeftList.add(uxDrawConfig); }
+ */
+
+ protected void drawPositionInformation() {
+
+ if (StrategyBoard.mainSquadLeaderPosition != null) {
+ Broodwar.drawTextMap(DrawingUtils.positionAdjusted(StrategyBoard.mainSquadLeaderPosition, 0, -20),
+ UxColor.CHAR_WHITE + "V");
+ }
+ if (StrategyBoard.campPosition.equals(StrategyBoard.mainPosition)) {
+ Broodwar.drawTextMap(StrategyBoard.campPosition, UxColor.CHAR_ORANGE + "camp & main");
+ } else {
+ if (StrategyBoard.campPosition != null) {
+ Broodwar.drawTextMap(StrategyBoard.campPosition, UxColor.CHAR_YELLOW + "camp");
+ }
+ if (StrategyBoard.mainPosition != null) {
+ Broodwar.drawTextMap(DrawingUtils.positionAdjusted(StrategyBoard.mainPosition, 0, -10),
+ UxColor.CHAR_RED + "main");
+ }
+ }
+ if (StrategyBoard.campPositionSiege != null) {
+ Broodwar.drawTextMap(StrategyBoard.campPositionSiege, UxColor.CHAR_YELLOW + "camp (siege)");
+ }
+ if (StrategyBoard.watcherPosition != null) {
+ Broodwar.drawTextMap(DrawingUtils.positionAdjusted(StrategyBoard.watcherPosition, 0, -20),
+ UxColor.CHAR_BLUE + "watcherPos");
+ }
+ if (StrategyBoard.mainSquadCenter != null) {
+ Broodwar.drawTextMap(StrategyBoard.mainSquadCenter, "mainSqCntr");
+ Broodwar.drawCircleMap(StrategyBoard.mainSquadCenter.getX(), StrategyBoard.mainSquadCenter.getY(),
+ StrategyBoard.mainSquadCoverRadius, Color.Cyan);
+ }
+ if (StrategyBoard.nearGroundEnemyPosition != null) {
+ Broodwar.drawTextMap(StrategyBoard.nearGroundEnemyPosition, UxColor.CHAR_RED + "nearEnemySq(Ground)");
+ Broodwar.drawCircleMap(StrategyBoard.nearGroundEnemyPosition, 150, Color.Red);
+ }
+ if (StrategyBoard.nearAirEnemyPosition != null) {
+ Broodwar.drawTextMap(StrategyBoard.nearAirEnemyPosition, UxColor.CHAR_RED + "nearEnemySq(Air)");
+ Broodwar.drawCircleMap(StrategyBoard.nearAirEnemyPosition, 150, Color.Red);
+ }
+ if (StrategyBoard.dropEnemyPosition != null) {
+ Broodwar.drawTextMap(StrategyBoard.dropEnemyPosition, UxColor.CHAR_RED + "dropEnemySq");
+ Broodwar.drawCircleMap(StrategyBoard.dropEnemyPosition, 150, Color.Red);
+ }
+ if (StrategyBoard.totalEnemyCneterPosition != null) {
+ Broodwar.drawTextMap(StrategyBoard.totalEnemyCneterPosition, "totalEnemySq");
+ Broodwar.drawCircleMap(StrategyBoard.totalEnemyCneterPosition, 250, Color.Red);
+ }
+ }
+
+ /*
+ * private void addDrawStrategyListOrigin() throws IllegalArgumentException,
+ * IllegalAccessException, ClassNotFoundException{ // TODO Auto-generated
+ * method stub if(!drawStrategyListOrigin[uxOption].isEmpty()){ UxDrawConfig
+ * uxDrawConfig; for (UxDrawConfig drwaConfig :
+ * drawStrategyListOrigin[uxOption]) {
+ * drwaConfig.setClazz(drwaConfig.getKey()); Class> c =
+ * drwaConfig.getClazz(); if(drwaConfig.getValue() != null){ Field fld =
+ * null; try{ Method method = c.getMethod("Instance"); Object obj =
+ * method.invoke(arg0, arg1); obj.getClass().getDeclaredField(name) fld =
+ * c.getDeclaredField(drwaConfig.getValue());
+ *
+ *
+ * if (!fld.isAccessible()) { fld.setAccessible(true); } } catch (Exception
+ * e) { System.out.println(e.getMessage()); continue; } uxDrawConfig =
+ * UxDrawConfig.newInstanceFieldType(fld.getName(),fld.get(drwaConfig.
+ * getValue()),drwaConfig.getColor());
+ * uxDrawConfig.setPos(drwaConfig.getPos()); if(drwaConfig.getPos() ==
+ * UxDrawConfig.posMap.get("L")){ drawStrategyLeftList.add(uxDrawConfig);
+ * }else if(drwaConfig.getPos() == UxDrawConfig.posMap.get("M")){
+ * drawStrategyMidList.add(uxDrawConfig); }else if(drwaConfig.getPos() ==
+ * UxDrawConfig.posMap.get("R")){ drawStrategyRightList.add(uxDrawConfig);
+ * }else{ drawStrategyLeftList.add(uxDrawConfig); } }
+ *
+ * } } }
+ */
+
+ // 600 * 300
+ protected void drawStrategyList() {
+ // TODO Auto-generated method stub
+ int nextLy = 20, nextMy = 20, nextRy = 20;
+
+ for (UxDrawConfig uxDraw : drawStrategyLeftList) {
+ int lineCnt = 1;
+ int fromIndex = -1;
+ Broodwar.drawTextScreen(uxDraw.getPos(), nextLy, uxDraw.getColor() + uxDraw.getClassFieldName());
+ while ((fromIndex = uxDraw.getClassFieldName().indexOf("\n", fromIndex + 1)) >= 0) {
+ lineCnt++;
+ }
+ nextLy += (lineCnt * 12);
+ }
+
+ for (UxDrawConfig uxDraw : drawStrategyMidList) {
+ int lineCnt = 1;
+ int fromIndex = -1;
+ Broodwar.drawTextScreen(uxDraw.getPos(), nextMy, uxDraw.getColor() + uxDraw.getClassFieldName());
+ while ((fromIndex = uxDraw.getClassFieldName().indexOf("\n", fromIndex + 1)) >= 0) {
+ lineCnt++;
+ }
+ nextMy += (lineCnt * 12);
+ }
+
+ for (UxDrawConfig uxDraw : drawStrategyRightList) {
+ int lineCnt = 1;
+ int fromIndex = -1;
+ Broodwar.drawTextScreen(uxDraw.getPos(), nextRy, uxDraw.getClassFieldName());
+ while ((fromIndex = uxDraw.getClassFieldName().indexOf("\n", fromIndex + 1)) >= 0) {
+ lineCnt++;
+ }
+ nextRy += (lineCnt * 12);
+ }
+
+ if (TimeUtils.getFrame() % 7 == 0) {
+ Broodwar.drawTextScreen(L, (nextLy + 24), " ");
+ Broodwar.drawTextScreen(M, (nextMy + 24), " ");
+ Broodwar.drawTextScreen(R, (nextRy + 24), " ");
+ } else {
+ Broodwar.drawTextScreen(L, (nextLy + 24), " : ");
+ Broodwar.drawTextScreen(M, (nextMy + 24), " : ");
+ Broodwar.drawTextScreen(R, (nextRy + 24), " : ");
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/monster/debugger/ScreenUx.java b/src/main/java/org/monster/debugger/ScreenUx.java
new file mode 100644
index 0000000..c6b594b
--- /dev/null
+++ b/src/main/java/org/monster/debugger/ScreenUx.java
@@ -0,0 +1,77 @@
+package org.monster.debugger;
+
+public class ScreenUx {
+
+ private static ScreenUx instance = new ScreenUx();
+ private static int uxOption;
+
+ public static void showDisplay() {
+ uxOption = PreBotUXManager.Instance().uxOption;
+ PreBotUXManager.Instance().clearList();
+ if (uxOption == 0) {
+ PreBotUXManager.Instance().drawDebugginUxMenu(); // drawing ux 메뉴 설명
+ PreBotUXManager.Instance().drawUxInfo(); // debuging 메뉴 설명 (화면 , 속도
+ // 등)
+ } else if (uxOption == 1) {
+ UXManager.Instance().update(); // 프리봇 전 기본 디버깅 메뉴
+ // 미네랄PATH
+ } else if (uxOption == 2) {
+ PreBotUXManager.Instance().drawGameInformationOnScreen();
+ PreBotUXManager.Instance().drawBWTAResultOnMap();
+ PreBotUXManager.Instance().drawBuildOrderQueueOnScreen();
+ PreBotUXManager.Instance().drawBuildStatusOnScreen();
+ PreBotUXManager.Instance().drawReservedBuildingTilesOnMap();
+ PreBotUXManager.Instance().drawTilesToAvoidOnMap();
+ PreBotUXManager.Instance().drawWorkerMiningStatusOnMap();
+ PreBotUXManager.Instance().drawUnitTargetOnMap();
+ // drawTurretMap();
+ PreBotUXManager.Instance().drawManagerTimeSpent();
+ PreBotUXManager.Instance().drawConstructionQueueOnScreenAndMap(); // ConstructionQueue
+
+ // draw tile position of mouse cursor
+ int mouseX = PreBotUXManager.Instance().Broodwar.getMousePosition().getX()
+ + PreBotUXManager.Instance().Broodwar.getScreenPosition().getX();
+ int mouseY = PreBotUXManager.Instance().Broodwar.getMousePosition().getY()
+ + PreBotUXManager.Instance().Broodwar.getScreenPosition().getY();
+ PreBotUXManager.Instance().Broodwar.drawTextMap(mouseX + 20, mouseY,
+ "(" + (int) (mouseX / 32) + ", " + (int) (mouseY / 32) + ")");
+ PreBotUXManager.Instance().Broodwar.drawTextMap(mouseX + 20, mouseY + 10,
+ "(" + (int) (mouseX) + ", " + (int) (mouseY) + ")");
+
+ } else if (uxOption == 3) {
+ PreBotUXManager.Instance().drawStrategy();
+ } else if (uxOption == 4) {
+ PreBotUXManager.Instance().drawEnemyBuildTimer();
+ } /*
+ * else if (uxOption == 5) { clearList(); drawSquadInfoOnMap();
+ * drawManagerTimeSpent(); drawDecision();
+ * drawEnemyAirDefenseRange(); drawAirForceInformation(); } else if
+ * (uxOption == 6) { clearList(); drawEnemyBaseToBaseTime(); } else
+ * if (uxOption == 7) { clearList(); drawBigWatch();
+ * drawManagerTimeSpent(); } else if (uxOption == 8) { clearList();
+ * drawTilesToAvoidOnMap(); drawReservedBuildingTilesOnMap(); } else
+ * if (uxOption == 9) { //drawExpectedResource();
+ * //drawExpectedResource2();
+ *
+ * }
+ */
+
+ PreBotUXManager.Instance().drawMineralIdOnMap();
+ PreBotUXManager.Instance().drawUnitIdOnMap();
+ PreBotUXManager.Instance().drawPositionInformation();
+ PreBotUXManager.Instance().drawTimer();
+ PreBotUXManager.Instance().drawPathData();
+ PreBotUXManager.Instance().drawSquadUnitTagMap();
+
+ /*
+ * try { PreBotUXManager.Instance().addDrawStrategyListOrigin(); } catch
+ * (IllegalArgumentException e) { // TODO Auto-generated catch block
+ * e.printStackTrace(); } catch (IllegalAccessException e) { // TODO
+ * Auto-generated catch block e.printStackTrace(); } catch
+ * (ClassNotFoundException e) { // TODO Auto-generated catch block
+ * e.printStackTrace(); }
+ */
+ PreBotUXManager.Instance().drawStrategyList();
+ PreBotUXManager.Instance().clearDecisionListForUx();
+ }
+}
diff --git a/src/main/java/org/monster/debugger/UXManager.java b/src/main/java/org/monster/debugger/UXManager.java
index d485cdf..8fc715d 100644
--- a/src/main/java/org/monster/debugger/UXManager.java
+++ b/src/main/java/org/monster/debugger/UXManager.java
@@ -1,20 +1,10 @@
package org.monster.debugger;
-import bwapi.Bullet;
-import bwapi.BulletType;
-import bwapi.Color;
-import bwapi.Force;
-import bwapi.Game;
-import bwapi.Player;
-import bwapi.Position;
-import bwapi.TilePosition;
-import bwapi.Unit;
-import bwapi.UnitType;
-import bwta.BWTA;
-import bwta.BaseLocation;
-import bwta.Chokepoint;
-import bwta.Polygon;
-import bwta.Region;
+import java.util.ArrayList;
+import java.util.Deque;
+import java.util.List;
+import java.util.Vector;
+
import org.monster.bootstrap.Config;
import org.monster.build.base.BuildManager;
import org.monster.build.base.BuildOrderItem;
@@ -31,919 +21,914 @@
import org.monster.worker.WorkerData;
import org.monster.worker.WorkerManager;
-import java.util.ArrayList;
-import java.util.Deque;
-import java.util.List;
-import java.util.Vector;
+import bwapi.Bullet;
+import bwapi.BulletType;
+import bwapi.Color;
+import bwapi.Force;
+import bwapi.Game;
+import bwapi.Player;
+import bwapi.Position;
+import bwapi.TilePosition;
+import bwapi.Unit;
+import bwapi.UnitType;
+import bwta.BWTA;
+import bwta.BaseLocation;
+import bwta.Chokepoint;
+import bwta.Polygon;
+import bwta.Region;
/// 봇 프로그램 개발의 편의성 향상을 위해 게임 화면에 추가 정보들을 표시하는 class
/// 여러 Manager 들로부터 정보를 조회하여 Screen 혹은 Map 에 정보를 표시합니다
public class UXManager {
- private static UXManager instance = new UXManager();
- private final Character brown = '';
- private final char red = '';
- private final char teal = '';
- // private final char blue = '';
- private final char purple = '';
- private final char white = '';
- private final int dotRadius = 2;
- private boolean hasSavedBWTAInfo = false;
- private int[][] blue = null;
- private int[][] cyan = null;
- private int[][] orange = null;
- private List yellow = new ArrayList();
- private List green1 = new ArrayList();
- private List green2 = new ArrayList();
- private List red1 = new ArrayList();
- private List red2 = new ArrayList();
- private String bulletTypeName = "";
- private String tempUnitName = "";
-
- private Game Broodwar;
-
- /// static singleton 객체를 리턴합니다
- public static UXManager Instance() {
- return instance;
- }
-
- /// 경기가 시작될 때 일회적으로 추가 정보를 출력합니다
- public void onStart(Game Broodwar) {
- this.Broodwar = Broodwar;
- }
-
- /// 경기 진행 중 매 프레임마다 추가 정보를 출력하고 사용자 입력을 처리합니다
- public void update() {
- drawGameInformationOnScreen(5, 5);
-
- if (Config.DrawEnemyUnitInfo) {
- drawUnitStatisticsOnScreen(400, 20);
- }
-
- if (Config.DrawBWTAInfo) {
- drawBWTAResultOnMap();
- }
-
- if (Config.DrawMapGrid) {
- drawMapGrid();
- }
-
- // 빌드오더큐 : 빌드 실행 전
- if (Config.DrawProductionInfo) {
- drawBuildOrderQueueOnScreen(80, 60);
- }
-
- // 빌드 실행 상황 : 건물 건설, 유닛 생산, 업그레이드, 리서치
- if (Config.DrawProductionInfo) {
- drawBuildStatusOnScreen(200, 60);
- }
-
- // 건물 건설 큐. 건물 건설 상황
- if (Config.DrawBuildingInfo) {
- drawConstructionQueueOnScreenAndMap(200, 150);
- }
-
- // 건물이 건설될 위치
- if (Config.DrawReservedBuildingTiles) {
- // 건물 건설 장소 예약 지점
- drawReservedBuildingTilesOnMap();
- // 건물 건설 불가 구역 (미네랄/가스/베이스 사이)
- drawTilesToAvoidOnMap();
- }
-
- if (Config.DrawUnitHealthBars) {
- drawUnitExtendedInformationOnMap();
- drawUnitIdOnMap();
- }
-
- if (Config.DrawWorkerInfo) {
- // 각 일꾼들의 임무 상황
- drawWorkerStateOnScreen(5, 60);
-
- // 베이스캠프당 일꾼 수
- drawWorkerCountOnMap();
- }
-
- // 일꾼 자원채취 임무 상황
- if (Config.DrawResourceInfo) {
- drawWorkerMiningStatusOnMap();
- }
-
- // 정찰
-// if (Config.DrawScoutInfo) {
-// drawScoutInformation(220,330);
-// }
-
- // 공격
- if (Config.DrawUnitTargetInfo) {
- drawUnitTargetOnMap();
-
- // 미사일, 럴커의 보이지않는 공격등을 표시
- drawBulletsOnMap();
- }
-
- // draw tile position of mouse cursor
- if (Config.DrawMouseCursorInfo) {
- int mouseX = Broodwar.getMousePosition().getX() + Broodwar.getScreenPosition().getX();
- int mouseY = Broodwar.getMousePosition().getY() + Broodwar.getScreenPosition().getY();
- Broodwar.drawTextMap(mouseX + 20, mouseY, "(" + (int) (mouseX / Config.TILE_SIZE) + ", " + (int) (mouseY / Config.TILE_SIZE) + ")");
- }
-
- }
-
- // 게임 개요 정보를 Screen 에 표시합니다
- public void drawGameInformationOnScreen(int x, int y) {
- Broodwar.drawTextScreen(x, y, white + "Players : ");
- //Broodwar.drawTextScreen(x + 50, y, Broodwar.self().getTextColor() + Broodwar.self().getName() + "(" + InformationManager.Instance().selfRace + ") " + white + " vs. " +
- // PlayerUtils.enemyPlayer().getTextColor() + PlayerUtils.enemyPlayer().getName() + "(" + PlayerUtils.enemyRace() + ")");
- y += 12;
-
- Broodwar.drawTextScreen(x, y, white + "Map : ");
- Broodwar.drawTextScreen(x + 50, y, white + Broodwar.mapFileName() + " (" + Broodwar.mapWidth() + " x " + Broodwar.mapHeight() + " size)");
- Broodwar.setTextSize();
- y += 12;
-
- Broodwar.drawTextScreen(x, y, white + "Time : ");
- Broodwar.drawTextScreen(x + 50, y, "" + white + TimeUtils.getFrame());
- Broodwar.drawTextScreen(x + 90, y, "" + white + (int) (TimeUtils.getFrame() / (23.8 * 60)) + ":" + (int) ((int) (TimeUtils.getFrame() / 23.8) % 60));
- }
-
- /// APM (Action Per Minute) 숫자를 Screen 에 표시합니다
- public void drawAPM(int x, int y) {
- int bwapiAPM = Broodwar.getAPM();
- Broodwar.drawTextScreen(x, y, "APM : " + bwapiAPM);
- }
-
- /// Players 정보를 Screen 에 표시합니다
- public void drawPlayers() {
- for (Player p : Broodwar.getPlayers()) {
- Broodwar.sendText("Player [" + p.getID() + "]: " + p.getName() + " is in force: " + p.getForce().getName());
- }
- }
-
- /// Player 들의 팀 (Force) 들의 정보를 Screen 에 표시합니다
- public void drawForces() {
- for (Force f : Broodwar.getForces()) {
- Broodwar.sendText("Force " + f.getName() + " has the following players:");
- for (Player p : f.getPlayers()) {
- Broodwar.sendText(" - Player [" + p.getID() + "]: " + p.getName());
- }
- }
- }
-
- /// Unit 의 HitPoint 등 추가 정보를 Map 에 표시합니다
- public void drawUnitExtendedInformationOnMap() {
- int verticalOffset = -10;
-
- for (UnitInfo ui : UnitUtils.getEnemyUnitInfoList()) {
-
- UnitType type = ui.getType();
- int hitPoints = ui.getLastHealth();
- int shields = ui.getLastShields();
-
- Position pos = ui.getLastPosition();
-
- int left = pos.getX() - type.dimensionLeft();
- int right = pos.getX() + type.dimensionRight();
- int top = pos.getY() - type.dimensionUp();
- int bottom = pos.getY() + type.dimensionDown();
-
- // 적 유닛이면 주위에 박스 표시
- if (!Broodwar.isVisible(ui.getLastPosition().toTilePosition())) {
- Broodwar.drawBoxMap(new Position(left, top), new Position(right, bottom), Color.Grey, false);
- Broodwar.drawTextMap(new Position(left + 3, top + 4), ui.getType().toString());
- }
-
- // 유닛의 HitPoint 남아있는 비율 표시
- if (!type.isResourceContainer() && type.maxHitPoints() > 0) {
- double hpRatio = (double) hitPoints / (double) type.maxHitPoints();
-
- Color hpColor = Color.Green;
- if (hpRatio < 0.66) hpColor = Color.Orange;
- if (hpRatio < 0.33) hpColor = Color.Red;
-
- int ratioRight = left + (int) ((right - left) * hpRatio);
- int hpTop = top + verticalOffset;
- int hpBottom = top + 4 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), hpColor, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
-
- int ticWidth = 3;
-
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
-
- // 유닛의 Shield 남아있는 비율 표시
- if (!type.isResourceContainer() && type.maxShields() > 0) {
- double shieldRatio = (double) shields / (double) type.maxShields();
-
- int ratioRight = left + (int) ((right - left) * shieldRatio);
- int hpTop = top - 3 + verticalOffset;
- int hpBottom = top + 1 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Blue, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
-
- int ticWidth = 3;
-
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
- }
-
- // draw neutral units and our units
- for (Unit unit : Broodwar.getAllUnits()) {
- if (unit.getPlayer() == PlayerUtils.enemyPlayer()) {
- continue;
- }
-
- final Position pos = unit.getPosition();
-
- int left = pos.getX() - unit.getType().dimensionLeft();
- int right = pos.getX() + unit.getType().dimensionRight();
- int top = pos.getY() - unit.getType().dimensionUp();
- int bottom = pos.getY() + unit.getType().dimensionDown();
-
- //Monster.game.drawBoxMap(BWAPI.Position(left, top), BWAPI.Position(right, bottom), Color.Grey, false);
-
- // 유닛의 HitPoint 남아있는 비율 표시
- if (!unit.getType().isResourceContainer() && unit.getType().maxHitPoints() > 0) {
- double hpRatio = (double) unit.getHitPoints() / (double) unit.getType().maxHitPoints();
-
- Color hpColor = Color.Green;
- if (hpRatio < 0.66) hpColor = Color.Orange;
- if (hpRatio < 0.33) hpColor = Color.Red;
-
- int ratioRight = left + (int) ((right - left) * hpRatio);
- int hpTop = top + verticalOffset;
- int hpBottom = top + 4 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), hpColor, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), hpColor.Black, false);
-
- int ticWidth = 3;
+ private static UXManager instance = new UXManager();
+ private final Character brown = '';
+ private final char red = '';
+ private final char teal = '';
+ // private final char blue = '';
+ private final char purple = '';
+ private final char white = '';
+ private final int dotRadius = 2;
+ private boolean hasSavedBWTAInfo = false;
+ private int[][] blue = null;
+ private int[][] cyan = null;
+ private int[][] orange = null;
+ private List yellow = new ArrayList();
+ private List green1 = new ArrayList();
+ private List green2 = new ArrayList();
+ private List red1 = new ArrayList();
+ private List red2 = new ArrayList();
+ private String bulletTypeName = "";
+ private String tempUnitName = "";
+
+ private Game Broodwar;
+
+ /// static singleton 객체를 리턴합니다
+ public static UXManager Instance() {
+ return instance;
+ }
+
+ /// 경기가 시작될 때 일회적으로 추가 정보를 출력합니다
+ public void onStart(Game Broodwar) {
+ this.Broodwar = Broodwar;
+ }
+
+ /// 경기 진행 중 매 프레임마다 추가 정보를 출력하고 사용자 입력을 처리합니다
+ public void update() {
+ drawGameInformationOnScreen(5, 5);
+
+ if (Config.DrawEnemyUnitInfo) {
+ drawUnitStatisticsOnScreen(400, 20);
+ }
+
+ if (Config.DrawBWTAInfo) {
+ drawBWTAResultOnMap();
+ }
+
+ if (Config.DrawMapGrid) {
+ drawMapGrid();
+ }
+
+ // 빌드오더큐 : 빌드 실행 전
+ if (Config.DrawProductionInfo) {
+ drawBuildOrderQueueOnScreen(80, 60);
+ }
+
+ // 빌드 실행 상황 : 건물 건설, 유닛 생산, 업그레이드, 리서치
+ if (Config.DrawProductionInfo) {
+ drawBuildStatusOnScreen(200, 60);
+ }
+
+ // 건물 건설 큐. 건물 건설 상황
+ if (Config.DrawBuildingInfo) {
+ drawConstructionQueueOnScreenAndMap(200, 150);
+ }
+
+ // 건물이 건설될 위치
+ if (Config.DrawReservedBuildingTiles) {
+ // 건물 건설 장소 예약 지점
+ drawReservedBuildingTilesOnMap();
+ // 건물 건설 불가 구역 (미네랄/가스/베이스 사이)
+ drawTilesToAvoidOnMap();
+ }
+
+ if (Config.DrawUnitHealthBars) {
+ drawUnitExtendedInformationOnMap();
+ drawUnitIdOnMap();
+ }
+
+ if (Config.DrawWorkerInfo) {
+ // 각 일꾼들의 임무 상황
+ drawWorkerStateOnScreen(5, 60);
+
+ // 베이스캠프당 일꾼 수
+ drawWorkerCountOnMap();
+ }
+
+ // 일꾼 자원채취 임무 상황
+ if (Config.DrawResourceInfo) {
+ drawWorkerMiningStatusOnMap();
+ }
+
+ // 정찰
+ // if (Config.DrawScoutInfo) {
+ // drawScoutInformation(220,330);
+ // }
+
+ // 공격
+ if (Config.DrawUnitTargetInfo) {
+ drawUnitTargetOnMap();
+
+ // 미사일, 럴커의 보이지않는 공격등을 표시
+ drawBulletsOnMap();
+ }
+
+ // draw tile position of mouse cursor
+ if (Config.DrawMouseCursorInfo) {
+ int mouseX = Broodwar.getMousePosition().getX() + Broodwar.getScreenPosition().getX();
+ int mouseY = Broodwar.getMousePosition().getY() + Broodwar.getScreenPosition().getY();
+ Broodwar.drawTextMap(mouseX + 20, mouseY,
+ "(" + (int) (mouseX / Config.TILE_SIZE) + ", " + (int) (mouseY / Config.TILE_SIZE) + ")");
+ }
+
+ }
+
+ // 게임 개요 정보를 Screen 에 표시합니다
+ public void drawGameInformationOnScreen(int x, int y) {
+ Broodwar.drawTextScreen(x, y, white + "Players : ");
+ // Broodwar.drawTextScreen(x + 50, y, Broodwar.self().getTextColor() +
+ // Broodwar.self().getName() + "(" +
+ // InformationManager.Instance().selfRace + ") " + white + " vs. " +
+ // PlayerUtils.enemyPlayer().getTextColor() +
+ // PlayerUtils.enemyPlayer().getName() + "(" + PlayerUtils.enemyRace() +
+ // ")");
+ y += 12;
+
+ Broodwar.drawTextScreen(x, y, white + "Map : ");
+ Broodwar.drawTextScreen(x + 50, y,
+ white + Broodwar.mapFileName() + " (" + Broodwar.mapWidth() + " x " + Broodwar.mapHeight() + " size)");
+ Broodwar.setTextSize();
+ y += 12;
+
+ Broodwar.drawTextScreen(x, y, white + "Time : ");
+ Broodwar.drawTextScreen(x + 50, y, "" + white + TimeUtils.getFrame());
+ Broodwar.drawTextScreen(x + 90, y, "" + white + (int) (TimeUtils.getFrame() / (23.8 * 60)) + ":"
+ + (int) ((int) (TimeUtils.getFrame() / 23.8) % 60));
+ }
+
+ /// APM (Action Per Minute) 숫자를 Screen 에 표시합니다
+ public void drawAPM(int x, int y) {
+ int bwapiAPM = Broodwar.getAPM();
+ Broodwar.drawTextScreen(x, y, "APM : " + bwapiAPM);
+ }
+
+ /// Players 정보를 Screen 에 표시합니다
+ public void drawPlayers() {
+ for (Player p : Broodwar.getPlayers()) {
+ Broodwar.sendText("Player [" + p.getID() + "]: " + p.getName() + " is in force: " + p.getForce().getName());
+ }
+ }
+
+ /// Player 들의 팀 (Force) 들의 정보를 Screen 에 표시합니다
+ public void drawForces() {
+ for (Force f : Broodwar.getForces()) {
+ Broodwar.sendText("Force " + f.getName() + " has the following players:");
+ for (Player p : f.getPlayers()) {
+ Broodwar.sendText(" - Player [" + p.getID() + "]: " + p.getName());
+ }
+ }
+ }
+
+ /// Unit 의 HitPoint 등 추가 정보를 Map 에 표시합니다
+ public void drawUnitExtendedInformationOnMap() {
+ int verticalOffset = -10;
+
+ for (UnitInfo ui : UnitUtils.getEnemyUnitInfoList()) {
+
+ UnitType type = ui.getType();
+ int hitPoints = ui.getLastHealth();
+ int shields = ui.getLastShields();
+
+ Position pos = ui.getLastPosition();
+
+ int left = pos.getX() - type.dimensionLeft();
+ int right = pos.getX() + type.dimensionRight();
+ int top = pos.getY() - type.dimensionUp();
+ int bottom = pos.getY() + type.dimensionDown();
+
+ // 적 유닛이면 주위에 박스 표시
+ if (!Broodwar.isVisible(ui.getLastPosition().toTilePosition())) {
+ Broodwar.drawBoxMap(new Position(left, top), new Position(right, bottom), Color.Grey, false);
+ Broodwar.drawTextMap(new Position(left + 3, top + 4), ui.getType().toString());
+ }
+
+ // 유닛의 HitPoint 남아있는 비율 표시
+ if (!type.isResourceContainer() && type.maxHitPoints() > 0) {
+ double hpRatio = (double) hitPoints / (double) type.maxHitPoints();
+
+ Color hpColor = Color.Green;
+ if (hpRatio < 0.66)
+ hpColor = Color.Orange;
+ if (hpRatio < 0.33)
+ hpColor = Color.Red;
+
+ int ratioRight = left + (int) ((right - left) * hpRatio);
+ int hpTop = top + verticalOffset;
+ int hpBottom = top + 4 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), hpColor, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+
+ // 유닛의 Shield 남아있는 비율 표시
+ if (!type.isResourceContainer() && type.maxShields() > 0) {
+ double shieldRatio = (double) shields / (double) type.maxShields();
+
+ int ratioRight = left + (int) ((right - left) * shieldRatio);
+ int hpTop = top - 3 + verticalOffset;
+ int hpBottom = top + 1 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Blue, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+ }
+
+ // draw neutral units and our units
+ for (Unit unit : Broodwar.getAllUnits()) {
+ if (unit.getPlayer() == PlayerUtils.enemyPlayer()) {
+ continue;
+ }
+
+ final Position pos = unit.getPosition();
+
+ int left = pos.getX() - unit.getType().dimensionLeft();
+ int right = pos.getX() + unit.getType().dimensionRight();
+ int top = pos.getY() - unit.getType().dimensionUp();
+ int bottom = pos.getY() + unit.getType().dimensionDown();
+
+ // Monster.game.drawBoxMap(BWAPI.Position(left, top),
+ // BWAPI.Position(right, bottom), Color.Grey, false);
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
+ // 유닛의 HitPoint 남아있는 비율 표시
+ if (!unit.getType().isResourceContainer() && unit.getType().maxHitPoints() > 0) {
+ double hpRatio = (double) unit.getHitPoints() / (double) unit.getType().maxHitPoints();
- // 유닛의 Shield 남아있는 비율 표시
- if (!unit.getType().isResourceContainer() && unit.getType().maxShields() > 0) {
- double shieldRatio = (double) unit.getShields() / (double) unit.getType().maxShields();
-
- int ratioRight = left + (int) ((right - left) * shieldRatio);
- int hpTop = top - 3 + verticalOffset;
- int hpBottom = top + 1 + verticalOffset;
-
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Blue, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
-
- int ticWidth = 3;
-
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
+ Color hpColor = Color.Green;
+ if (hpRatio < 0.66)
+ hpColor = Color.Orange;
+ if (hpRatio < 0.33)
+ hpColor = Color.Red;
- // Mineral / Gas 가 얼마나 남아있는가
- if (unit.getType().isResourceContainer() && unit.getInitialResources() > 0) {
- double mineralRatio = (double) unit.getResources() / (double) unit.getInitialResources();
+ int ratioRight = left + (int) ((right - left) * hpRatio);
+ int hpTop = top + verticalOffset;
+ int hpBottom = top + 4 + verticalOffset;
- int ratioRight = left + (int) ((right - left) * mineralRatio);
- int hpTop = top + verticalOffset;
- int hpBottom = top + 4 + verticalOffset;
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), hpColor, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), hpColor.Black, false);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Cyan, true);
- Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
-
- int ticWidth = 3;
+ int ticWidth = 3;
- for (int i = left; i < right - 1; i += ticWidth) {
- Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
- }
- }
- }
- }
-
- /// UnitType 별 통계 정보를 Screen 에 표시합니다
- public void drawUnitStatisticsOnScreen(int x, int y) {
- int currentY = y;
-
- // 아군이 입은 피해 누적값
- currentY += 10;
-
- // 아군 모든 유닛 숫자 합계
- //Broodwar.drawTextScreen(x, currentY, white + " allUnitCount: " + UnitUtils.getUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- // 아군 건설/훈련 완료한 유닛 숫자 합계
- //Broodwar.drawTextScreen(x, currentY, white + " completedUnitCount: " + UnitUtils.getCompletedUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- // 아군 건설/훈련중인 유닛 숫자 합계
- //Broodwar.drawTextScreen(x, currentY, white + " incompleteUnitCount: " + Broodwar.self().incompleteUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- // 아군 유닛 파괴/사망 숫자 누적값
- //Broodwar.drawTextScreen(x, currentY, white + " deadUnitCount: " + Broodwar.self().deadUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- // 상대방 유닛을 파괴/사망 시킨 숫자 누적값
- //Broodwar.drawTextScreen(x, currentY, white + " killedUnitCount: " + Broodwar.self().killedUnitCount(UnitType.AllUnits));
- //currentY += 10;
-
- //Broodwar.drawTextScreen(x, currentY, white + " UnitScore: " + Broodwar.self().getUnitScore());
- //currentY += 10;
- //Broodwar.drawTextScreen(x, currentY, white + " RazingScore: " + Broodwar.self().getRazingScore());
- //currentY += 10;
- //Broodwar.drawTextScreen(x, currentY, white + " BuildingScore: " + Broodwar.self().getBuildingScore());
- //currentY += 10;
- //Broodwar.drawTextScreen(x, currentY, white + " KillScore: " + Broodwar.self().getKillScore());
- //currentY += 10;
-
- // 적군의 UnitType 별 파악된 Unit 숫자를 표시
- Broodwar.drawTextScreen(x, currentY + 20, white + " UNIT NAME");
- Broodwar.drawTextScreen(x + 110, currentY + 20, white + " Created");
- Broodwar.drawTextScreen(x + 150, currentY + 20, white + " Dead");
- Broodwar.drawTextScreen(x + 190, currentY + 20, white + " Alive");
-
- int yspace = 0;
-
- }
-
- /// BWTA 라이브러리에 의한 Map 분석 결과 정보를 Map 에 표시합니다
- public void drawBWTAResultOnMap() {
- /*//we will iterate through all the base locations, and draw their outlines.
- // C+ . for (std.set.const_iterator i = BWTA.getBaseLocations().begin(); i != BWTA.getBaseLocations().end(); i++)
- for(BaseLocation baseLocation : BWTA.getBaseLocations())
- {
- TilePosition p = baseLocation.getTilePosition();
- Position c = baseLocation.getPosition();
-
- //draw outline of Base location
- Broodwar.drawBoxMap(p.getX() * 32, p.getY() * 32, p.getX() * 32 + 4 * 32, p.getY() * 32 + 3 * 32, Color.Blue);
-
- //draw a circle at each mineral patch
- // C++ : for (BWAPI.Unitset.iterator j = (*i).getStaticMinerals().begin(); j != (*i).getStaticMinerals().end(); j++)
- for(Unit unit : baseLocation.getStaticMinerals())
- {
- Position q = unit.getInitialPosition();
- Broodwar.drawCircleMap(q.getX(), q.getY(), 30, Color.Cyan);
- }
-
- //draw the outlines of vespene geysers
- // C++ : for (BWAPI.Unitset.iterator j = (*i).getGeysers().begin(); j != (*i).getGeysers().end(); j++)
- for(Unit unit :baseLocation.getGeysers() )
- {
- TilePosition q = unit.getInitialTilePosition();
- Broodwar.drawBoxMap(q.getX() * 32, q.getY() * 32, q.getX() * 32 + 4 * 32, q.getY() * 32 + 2 * 32, Color.Orange);
- }
-
- //if this is an island expansion, draw a yellow circle around the base location
- if (baseLocation.isIsland())
- {
- Broodwar.drawCircleMap(c, 80, Color.Yellow);
- }
- }
-
- //we will iterate through all the regions and draw the polygon outline of it in green.
- // C++ : for (std.set.const_iterator r = BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
- for(Region region : BWTA.getRegions())
- {
- Polygon p = region.getPolygon();
- for (int j = 0; j.const_iterator r = BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
- for(Region region : BWTA.getRegions())
- {
- // C++ : for (std.set.const_iterator c = (*r).getChokepoints().begin(); c != (*r).getChokepoints().end(); c++)
- for(Chokepoint Chokepoint : region.getChokepoints())
- {
- Position point1 = Chokepoint.getSides().first;
- Position point2 = Chokepoint.getSides().second;
- Broodwar.drawLineMap(point1, point2, Color.Red);
- }
- }*/
- int blueCount = 0;
- int cyanCount = 0;
- int orangeCount = 0;
-
- if (hasSavedBWTAInfo == false) {
- for (BaseLocation baseLocation : BWTA.getBaseLocations()) {
- blueCount++;
- for (Unit unit : baseLocation.getStaticMinerals()) {
- cyanCount++;
- }
- for (Unit unit : baseLocation.getGeysers()) {
- orangeCount++;
- }
- }
-
- blue = new int[blueCount][4];
- int blueIndex = 0;
- cyan = new int[cyanCount][2];
- int cyanIndex = 0;
- orange = new int[orangeCount][4];
- int orangeIndex = 0;
-
- for (BaseLocation baseLocation : BWTA.getBaseLocations()) {
- TilePosition p = baseLocation.getTilePosition();
- Position c = baseLocation.getPosition();
-
- blue[blueIndex][0] = p.getX() * 32;
- blue[blueIndex][1] = p.getY() * 32;
- blue[blueIndex][2] = p.getX() * 32 + 4 * 32;
- blue[blueIndex][3] = p.getY() * 32 + 3 * 32;
- blueIndex++;
-
- //draw a circle at each mineral patch
- // C++ : for (BWAPI.Unitset.iterator j = (*i).getStaticMinerals().begin(); j != (*i).getStaticMinerals().end(); j++)
- for (Unit unit : baseLocation.getStaticMinerals()) {
- Position q = unit.getInitialPosition();
- cyan[cyanIndex][0] = q.getX();
- cyan[cyanIndex][1] = q.getY();
- cyanIndex++;
- }
-
- //draw the outlines of vespene geysers
- // C++ : for (BWAPI.Unitset.iterator j = (*i).getGeysers().begin(); j != (*i).getGeysers().end(); j++)
- for (Unit unit : baseLocation.getGeysers()) {
- TilePosition q = unit.getInitialTilePosition();
- orange[orangeIndex][0] = q.getX() * 32;
- orange[orangeIndex][1] = q.getY() * 32;
- orange[orangeIndex][2] = q.getX() * 32 + 4 * 32;
- orange[orangeIndex][3] = q.getY() * 32 + 2 * 32;
- orangeIndex++;
- }
-
- //if this is an island expansion, draw a yellow circle around the base location
- if (baseLocation.isIsland()) {
- yellow.add(c);
- }
- }
-
- //we will iterate through all the regions and draw the polygon outline of it in green.
- // C++ : for (std.set.const_iterator r = BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
- for (Region region : BWTA.getRegions()) {
- Polygon p = region.getPolygon();
- for (int j = 0; j < p.getPoints().size(); j++) {
- green1.add(p.getPoints().get(j));
- green2.add(p.getPoints().get((j + 1) % p.getPoints().size()));
- }
- }
-
- //we will visualize the chokepoints with red lines
- // C++ : for (std.set.const_iterator r = BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
- for (Region region : BWTA.getRegions()) {
- // C++ : for (std.set.const_iterator c = (*r).getChokepoints().begin(); c != (*r).getChokepoints().end(); c++)
- for (Chokepoint Chokepoint : region.getChokepoints()) {
- red1.add(Chokepoint.getSides().first);
- red2.add(Chokepoint.getSides().second);
- }
- }
- hasSavedBWTAInfo = true;
-
-// System.out.println(blueCount + " " + cyanCount + " " + orangeCount + " " + yellowCount + " " + greenCount + " " + redCount);
- }
-
- if (hasSavedBWTAInfo) {
- for (int i1 = 0; i1 < blue.length; i1++) {
- Broodwar.drawBoxMap(blue[i1][0], blue[i1][1], blue[i1][2], blue[i1][3], Color.Blue);
- }
- for (int i2 = 0; i2 < cyan.length; i2++) {
- Broodwar.drawCircleMap(cyan[i2][0], cyan[i2][1], 30, Color.Cyan);
- }
- for (int i3 = 0; i3 < orange.length; i3++) {
- Broodwar.drawBoxMap(orange[i3][0], orange[i3][1], orange[i3][2], orange[i3][3], Color.Orange);
- }
- for (int i4 = 0; i4 < yellow.size(); i4++) {
- Broodwar.drawCircleMap(yellow.get(i4), 80, Color.Yellow);
- }
- for (int i5 = 0; i5 < green1.size(); i5++) {
- Broodwar.drawLineMap(green1.get(i5), green2.get(i5), Color.Green);
- }
- for (int i6 = 0; i6 < red1.size(); i6++) {
- Broodwar.drawLineMap(red1.get(i6), red2.get(i6), Color.Red);
- }
-
- // OccupiedBaseLocation 을 원으로 표시
-// for (BaseLocation baseLocation : InformationManager.Instance().getOccupiedBaseLocations(PlayerUtils.myPlayer())) {
-// Broodwar.drawCircleMap(baseLocation.getPosition(), 10 * Config.TILE_SIZE, Color.Blue);
-// }
-// for (BaseLocation baseLocation : UnitTypeUtils.getOccupiedBaseLocations(PlayerUtils.enemyPlayer())) {
-// Broodwar.drawCircleMap(baseLocation.getPosition(), 10 * Config.TILE_SIZE, Color.Red);
-// }
-
- // ChokePoint, BaseLocation 을 텍스트로 표시
- if (ChokeUtils.myFirstChoke() != null) {
- Broodwar.drawTextMap(BaseUtils.myMainBase().getPosition(), "My MainBaseLocation");
- }
- if (ChokeUtils.myFirstChoke() != null) {
- Broodwar.drawTextMap(ChokeUtils.myFirstChoke().getCenter(), "My First ChokePoint");
- }
- if (ChokeUtils.mySecondChoke() != null) {
- Broodwar.drawTextMap(ChokeUtils.mySecondChoke().getCenter(), "My Second ChokePoint");
- }
- if (BaseUtils.myFirstExpansion() != null) {
- Broodwar.drawTextMap(BaseUtils.myFirstExpansion().getPosition(), "My First ExpansionLocation");
- }
-
-// if (InformationManager.Instance().getFirstChokePoint(PlayerUtils.enemyPlayer()) != null) {
-// Broodwar.drawTextMap(BaseUtils.enemyMainBase().getPosition(), "Enemy MainBaseLocation");
-// }
-// if (InformationManager.Instance().getFirstChokePoint(PlayerUtils.enemyPlayer()) != null) {
-// Broodwar.drawTextMap(InformationManager.Instance().getFirstChokePoint(PlayerUtils.enemyPlayer()).getCenter(), "Enemy First ChokePoint");
-// }
- if (ChokeUtils.enemySecondChoke() != null) {
- Broodwar.drawTextMap(ChokeUtils.enemySecondChoke().getCenter(), "Enemy Second ChokePoint");
- }
- if (BaseUtils.enemyFirstExpansion() != null) {
- Broodwar.drawTextMap(BaseUtils.enemyFirstExpansion().getPosition(), "Enemy First ExpansionLocation");
- }
-
- }
- }
-
- /// Tile Position 그리드를 Map 에 표시합니다
- public void drawMapGrid() {
- int cellSize = MapGrid.Instance().getCellSize();
- int mapWidth = MapGrid.Instance().getMapWidth();
- int mapHeight = MapGrid.Instance().getMapHeight();
- int rows = MapGrid.Instance().getRows();
- int cols = MapGrid.Instance().getCols();
-
- for (int i = 0; i < cols; i++) {
- Broodwar.drawLineMap(i * cellSize, 0, i * cellSize, mapHeight, Color.Blue);
- }
-
- for (int j = 0; j < rows; j++) {
- Broodwar.drawLineMap(0, j * cellSize, mapWidth, j * cellSize, Color.Blue);
- }
-
- for (int r = 0; r < rows; r += 2) {
- for (int c = 0; c < cols; c += 2) {
- Broodwar.drawTextMap(c * 32, r * 32, c + "," + r);
- }
- }
- }
-
- /// BuildOrderQueue 를 Screen 에 표시합니다
- public void drawBuildOrderQueueOnScreen(int x, int y) {
- Broodwar.drawTextScreen(x, y, white + " ");
-
- /*
- std.deque< BuildOrderItem >* queue = BuildManager.Instance().buildQueue.getQueue();
- size_t reps = queue.size() < 24 ? queue.size() : 24;
- for (size_t i(0); i buildQueue = BuildManager.Instance().buildQueue.getQueue();
- int itemCount = 0;
-
- // C++ : for (std.deque.reverse_iterator itr = buildQueue.rbegin(); itr != buildQueue.rend(); itr++) {
- // C++ : BuildOrderItem & currentItem = *itr;
- // C++ : Monster.game.drawTextScreen(x, y + 10 + (itemCount * 10), " %s", currentItem.metaType.getName().c_str());
- // C++ : itemCount++;
- // C++ : if (itemCount >= 24) break;
- // C++ : }
-
- Object[] tempQueue = buildQueue.toArray();
-
- for (int i = 0; i < tempQueue.length; i++) {
- BuildOrderItem currentItem = (BuildOrderItem) tempQueue[i];
- Broodwar.drawTextScreen(x, y + 10 + (itemCount * 10), white + currentItem.metaType.getName() + " " + currentItem.blocking);
- itemCount++;
- if (itemCount >= 24) break;
- }
- }
-
- /// Build 진행 상태를 Screen 에 표시합니다
- public void drawBuildStatusOnScreen(int x, int y) {
- // 건설 / 훈련 중인 유닛 진행상황 표시
- Vector unitsUnderConstruction = new Vector();
- for (Unit unit : Broodwar.self().getUnits()) {
- if (unit != null && unit.isBeingConstructed()) {
- unitsUnderConstruction.add(unit);
- }
- }
-
- // sort it based on the time it was started
- Object[] tempArr = unitsUnderConstruction.toArray();
- //Arrays.sort(tempArr);
- unitsUnderConstruction = new Vector();
- for (int i = 0; i < tempArr.length; i++) {
- unitsUnderConstruction.add((Unit) tempArr[i]);
- }
- // C++ : std.sort(unitsUnderConstruction.begin(), unitsUnderConstruction.end(), CompareWhenStarted());
-
- Broodwar.drawTextScreen(x, y, white + " ");
-
- int reps = unitsUnderConstruction.size() < 10 ? unitsUnderConstruction.size() : 10;
-
- for (Unit unit : unitsUnderConstruction) {
- y += 10;
- UnitType t = unit.getType();
- if (t == UnitType.Zerg_Egg) {
- t = unit.getBuildType();
- }
-
- Broodwar.drawTextScreen(x, y, "" + white + t + " (" + unit.getRemainingBuildTime() + ")");
- }
-
- // Tech Research 표시
-
- // Upgrade 표시
- }
-
- /// Construction 을 하기 위해 예약해둔 Tile 들을 Map 에 표시합니다
- public void drawReservedBuildingTilesOnMap() {
- boolean[][] reserveMap = ConstructionPlaceFinder.Instance().getReserveMap();
- if (reserveMap.length > 0 && reserveMap[0] != null && reserveMap[0].length > 0) {
- int rwidth = reserveMap.length;
- int rheight = reserveMap[0].length;
-
- for (int x = 0; x < rwidth; ++x) {
- for (int y = 0; y < rheight; ++y) {
- if (reserveMap[x][y]) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Yellow, false);
- }
- }
- }
- }
- }
-
- /// Construction 을 하지 못하는 Tile 들을 Map 에 표시합니다
- public void drawTilesToAvoidOnMap() {
-// Set tilesToAvoid = ConstructionPlaceFinder.Instance().getTilesToAvoid();
-// for (TilePosition t : tilesToAvoid)
-// {
-// int x1 = t.getX() * 32 + 8;
-// int y1 = t.getY() * 32 + 8;
-// int x2 = (t.getX() + 1) * 32 - 8;
-// int y2 = (t.getY() + 1) * 32 - 8;
- //
-// Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Orange, false);
-// }
- int y = 0;
- int x = 0;
-
-
- for (y = 0; y < 128; y++) {
- for (x = 0; x < 128; x++) {
- if (ConstructionPlaceFinder.Instance().getTilesToAvoid(x, y)) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Orange, false);
- }
-//
- }
- }
-
-
- for (y = 0; y < 128; y++) {
- for (x = 0; x < 128; x++) {
- if (ConstructionPlaceFinder.Instance().getTilesToAvoid(x, y)) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Orange, false);
- }
- if (ConstructionPlaceFinder.Instance().getTilesToAvoidAbsolute(x, y)) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Purple, false);
- }
- if (ConstructionPlaceFinder.Instance().getTilesToAvoidSupply(x, y)) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Red, false);
- }
-
- if (ConstructionPlaceFinder.Instance().getTilesToAvoidAddonBuilding(x, y)) {
- int x1 = x * 32 + 8;
- int y1 = y * 32 + 8;
- int x2 = (x + 1) * 32 - 8;
- int y2 = (y + 1) * 32 - 8;
-
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Black, false);
- }
-//
- }
- }
- }
-
- /// ConstructionQueue 를 Screen 에 표시합니다
- public void drawConstructionQueueOnScreenAndMap(int x, int y) {
- Broodwar.drawTextScreen(x, y, white + " ");
-
- int yspace = 0;
-
- Vector constructionQueue = ConstructionManager.Instance().getConstructionQueue();
-
- for (final ConstructionTask b : constructionQueue) {
- String constructionState = "";
-
- if (b.getStatus() == ConstructionTask.ConstructionStatus.Unassigned.ordinal()) {
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), "" + white + b.getType() + " - No Worker");
- } else if (b.getStatus() == ConstructionTask.ConstructionStatus.Assigned.ordinal()) {
- if (b.getConstructionWorker() == null) {
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), b.getType() + " - Assigned Worker Null");
- } else {
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), b.getType() + " - Assigned Worker " + b.getConstructionWorker().getID() + ", Position (" + b.getFinalPosition().getX() + "," + b.getFinalPosition().getY() + ")");
- }
-
- int x1 = b.getFinalPosition().getX() * 32;
- int y1 = b.getFinalPosition().getY() * 32;
- int x2 = (b.getFinalPosition().getX() + b.getType().tileWidth()) * 32;
- int y2 = (b.getFinalPosition().getY() + b.getType().tileHeight()) * 32;
-
- Broodwar.drawLineMap(b.getConstructionWorker().getPosition().getX(), b.getConstructionWorker().getPosition().getY(), (x1 + x2) / 2, (y1 + y2) / 2, Color.Orange);
- Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Red, false);
- } else if (b.getStatus() == ConstructionTask.ConstructionStatus.UnderConstruction.ordinal()) {
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), "" + white + b.getType() + " - Under Construction");
- }
- yspace++;
- }
- }
-
- /// Unit 의 Id 를 Map 에 표시합니다
- public void drawUnitIdOnMap() {
- for (Unit unit : Broodwar.self().getUnits()) {
- Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + white + unit.getID());
- }
- for (Unit unit : Broodwar.enemy().getUnits()) {
- Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + white + unit.getID());
- }
- }
-
- /// Worker Unit 들의 상태를 Screen 에 표시합니다
- public void drawWorkerStateOnScreen(int x, int y) {
- WorkerData workerData = WorkerManager.Instance().getWorkerData();
-
- Broodwar.drawTextScreen(x, y, white + "");
-
- int yspace = 0;
-
- for (Unit unit : workerData.getWorkers()) {
- if (unit == null) continue;
-
- // Mineral / Gas / Idle Worker 는 표시 안한다
- if (workerData.getJobCode(unit) == 'M' || workerData.getJobCode(unit) == 'I' || workerData.getJobCode(unit) == 'G') {
- continue;
- }
-
- Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), white + " " + unit.getID());
-
- if (workerData.getJobCode(unit) == 'B') {
- Broodwar.drawTextScreen(x + 30, y + 10 + ((yspace++) * 10), white + " " + workerData.getJobCode(unit) + " " + unit.getBuildType() + " " + (unit.isConstructing() ? 'Y' : 'N') + " (" + unit.getTilePosition().getX() + ", " + unit.getTilePosition().getY() + ")");
- } else {
- Broodwar.drawTextScreen(x + 30, y + 10 + ((yspace++) * 10), white + " " + workerData.getJobCode(unit));
- }
- }
- }
-
- /// ResourceDepot 별 Worker 숫자를 Map 에 표시합니다
- public void drawWorkerCountOnMap() {
- for (Unit depot : WorkerManager.Instance().getWorkerData().getDepots()) {
- if (depot == null) continue;
-
- int x = depot.getPosition().getX() - 64;
- int y = depot.getPosition().getY() - 32;
-
- Broodwar.drawBoxMap(x - 2, y - 1, x + 75, y + 14, Color.Black, true);
- Broodwar.drawTextMap(x, y, white + " Workers: " + WorkerManager.Instance().getWorkerData().getNumAssignedWorkers(depot));
- }
- }
-
- /// Worker Unit 의 자원채취 현황을 Map 에 표시합니다
- public void drawWorkerMiningStatusOnMap() {
- WorkerData workerData = WorkerManager.Instance().getWorkerData();
-
- for (Unit worker : workerData.getWorkers()) {
- if (worker == null) continue;
-
- Position pos = worker.getTargetPosition();
-
- Broodwar.drawTextMap(worker.getPosition().getX(), worker.getPosition().getY() - 5, "" + white + workerData.getJobCode(worker));
-
- Broodwar.drawLineMap(worker.getPosition().getX(), worker.getPosition().getY(), pos.getX(), pos.getY(), Color.Cyan);
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+
+ // 유닛의 Shield 남아있는 비율 표시
+ if (!unit.getType().isResourceContainer() && unit.getType().maxShields() > 0) {
+ double shieldRatio = (double) unit.getShields() / (double) unit.getType().maxShields();
+
+ int ratioRight = left + (int) ((right - left) * shieldRatio);
+ int hpTop = top - 3 + verticalOffset;
+ int hpBottom = top + 1 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Blue, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+
+ // Mineral / Gas 가 얼마나 남아있는가
+ if (unit.getType().isResourceContainer() && unit.getInitialResources() > 0) {
+ double mineralRatio = (double) unit.getResources() / (double) unit.getInitialResources();
+
+ int ratioRight = left + (int) ((right - left) * mineralRatio);
+ int hpTop = top + verticalOffset;
+ int hpBottom = top + 4 + verticalOffset;
+
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Grey, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(ratioRight, hpBottom), Color.Cyan, true);
+ Broodwar.drawBoxMap(new Position(left, hpTop), new Position(right, hpBottom), Color.Black, false);
+
+ int ticWidth = 3;
+
+ for (int i = left; i < right - 1; i += ticWidth) {
+ Broodwar.drawLineMap(new Position(i, hpTop), new Position(i, hpBottom), Color.Black);
+ }
+ }
+ }
+ }
+
+ /// UnitType 별 통계 정보를 Screen 에 표시합니다
+ public void drawUnitStatisticsOnScreen(int x, int y) {
+ int currentY = y;
+
+ // 아군이 입은 피해 누적값
+ currentY += 10;
+
+ // 적군의 UnitType 별 파악된 Unit 숫자를 표시
+ Broodwar.drawTextScreen(x, currentY + 20, white + " UNIT NAME");
+ Broodwar.drawTextScreen(x + 110, currentY + 20, white + " Created");
+ Broodwar.drawTextScreen(x + 150, currentY + 20, white + " Dead");
+ Broodwar.drawTextScreen(x + 190, currentY + 20, white + " Alive");
+
+ int yspace = 0;
+
+ }
+
+ /// BWTA 라이브러리에 의한 Map 분석 결과 정보를 Map 에 표시합니다
+ public void drawBWTAResultOnMap() {
+ int blueCount = 0;
+ int cyanCount = 0;
+ int orangeCount = 0;
+
+ if (hasSavedBWTAInfo == false) {
+ for (BaseLocation baseLocation : BWTA.getBaseLocations()) {
+ blueCount++;
+ for (Unit unit : baseLocation.getStaticMinerals()) {
+ cyanCount++;
+ }
+ for (Unit unit : baseLocation.getGeysers()) {
+ orangeCount++;
+ }
+ }
+
+ blue = new int[blueCount][4];
+ int blueIndex = 0;
+ cyan = new int[cyanCount][2];
+ int cyanIndex = 0;
+ orange = new int[orangeCount][4];
+ int orangeIndex = 0;
+
+ for (BaseLocation baseLocation : BWTA.getBaseLocations()) {
+ TilePosition p = baseLocation.getTilePosition();
+ Position c = baseLocation.getPosition();
+
+ blue[blueIndex][0] = p.getX() * 32;
+ blue[blueIndex][1] = p.getY() * 32;
+ blue[blueIndex][2] = p.getX() * 32 + 4 * 32;
+ blue[blueIndex][3] = p.getY() * 32 + 3 * 32;
+ blueIndex++;
+
+ // draw a circle at each mineral patch
+ // C++ : for (BWAPI.Unitset.iterator j =
+ // (*i).getStaticMinerals().begin(); j !=
+ // (*i).getStaticMinerals().end(); j++)
+ for (Unit unit : baseLocation.getStaticMinerals()) {
+ Position q = unit.getInitialPosition();
+ cyan[cyanIndex][0] = q.getX();
+ cyan[cyanIndex][1] = q.getY();
+ cyanIndex++;
+ }
+
+ // draw the outlines of vespene geysers
+ // C++ : for (BWAPI.Unitset.iterator j =
+ // (*i).getGeysers().begin(); j != (*i).getGeysers().end(); j++)
+ for (Unit unit : baseLocation.getGeysers()) {
+ TilePosition q = unit.getInitialTilePosition();
+ orange[orangeIndex][0] = q.getX() * 32;
+ orange[orangeIndex][1] = q.getY() * 32;
+ orange[orangeIndex][2] = q.getX() * 32 + 4 * 32;
+ orange[orangeIndex][3] = q.getY() * 32 + 2 * 32;
+ orangeIndex++;
+ }
+
+ // if this is an island expansion, draw a yellow circle around
+ // the base location
+ if (baseLocation.isIsland()) {
+ yellow.add(c);
+ }
+ }
+
+ // we will iterate through all the regions and draw the polygon
+ // outline of it in green.
+ // C++ : for (std.set.const_iterator r =
+ // BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
+ for (Region region : BWTA.getRegions()) {
+ Polygon p = region.getPolygon();
+ for (int j = 0; j < p.getPoints().size(); j++) {
+ green1.add(p.getPoints().get(j));
+ green2.add(p.getPoints().get((j + 1) % p.getPoints().size()));
+ }
+ }
+
+ // we will visualize the chokepoints with red lines
+ // C++ : for (std.set.const_iterator r =
+ // BWTA.getRegions().begin(); r != BWTA.getRegions().end(); r++)
+ for (Region region : BWTA.getRegions()) {
+ // C++ : for (std.set.const_iterator c =
+ // (*r).getChokepoints().begin(); c !=
+ // (*r).getChokepoints().end(); c++)
+ for (Chokepoint Chokepoint : region.getChokepoints()) {
+ red1.add(Chokepoint.getSides().first);
+ red2.add(Chokepoint.getSides().second);
+ }
+ }
+ hasSavedBWTAInfo = true;
+
+ // System.out.println(blueCount + " " + cyanCount + " " +
+ // orangeCount + " " + yellowCount + " " + greenCount + " " +
+ // redCount);
+ }
+
+ if (hasSavedBWTAInfo) {
+ for (int i1 = 0; i1 < blue.length; i1++) {
+ Broodwar.drawBoxMap(blue[i1][0], blue[i1][1], blue[i1][2], blue[i1][3], Color.Blue);
+ }
+ for (int i2 = 0; i2 < cyan.length; i2++) {
+ Broodwar.drawCircleMap(cyan[i2][0], cyan[i2][1], 30, Color.Cyan);
+ }
+ for (int i3 = 0; i3 < orange.length; i3++) {
+ Broodwar.drawBoxMap(orange[i3][0], orange[i3][1], orange[i3][2], orange[i3][3], Color.Orange);
+ }
+ for (int i4 = 0; i4 < yellow.size(); i4++) {
+ Broodwar.drawCircleMap(yellow.get(i4), 80, Color.Yellow);
+ }
+ for (int i5 = 0; i5 < green1.size(); i5++) {
+ Broodwar.drawLineMap(green1.get(i5), green2.get(i5), Color.Green);
+ }
+ for (int i6 = 0; i6 < red1.size(); i6++) {
+ Broodwar.drawLineMap(red1.get(i6), red2.get(i6), Color.Red);
+ }
+
+ // OccupiedBaseLocation 을 원으로 표시
+ // for (BaseLocation baseLocation :
+ // InformationManager.Instance().getOccupiedBaseLocations(PlayerUtils.myPlayer()))
+ // {
+ // Broodwar.drawCircleMap(baseLocation.getPosition(), 10 *
+ // Config.TILE_SIZE, Color.Blue);
+ // }
+ // for (BaseLocation baseLocation :
+ // UnitTypeUtils.getOccupiedBaseLocations(PlayerUtils.enemyPlayer()))
+ // {
+ // Broodwar.drawCircleMap(baseLocation.getPosition(), 10 *
+ // Config.TILE_SIZE, Color.Red);
+ // }
+
+ // ChokePoint, BaseLocation 을 텍스트로 표시
+ if (ChokeUtils.myFirstChoke() != null) {
+ Broodwar.drawTextMap(BaseUtils.myMainBase().getPosition(), "My MainBaseLocation");
+ }
+ if (ChokeUtils.myFirstChoke() != null) {
+ Broodwar.drawTextMap(ChokeUtils.myFirstChoke().getCenter(), "My First ChokePoint");
+ }
+ if (ChokeUtils.mySecondChoke() != null) {
+ Broodwar.drawTextMap(ChokeUtils.mySecondChoke().getCenter(), "My Second ChokePoint");
+ }
+ if (BaseUtils.myFirstExpansion() != null) {
+ Broodwar.drawTextMap(BaseUtils.myFirstExpansion().getPosition(), "My First ExpansionLocation");
+ }
+
+ // if
+ // (InformationManager.Instance().getFirstChokePoint(PlayerUtils.enemyPlayer())
+ // != null) {
+ // Broodwar.drawTextMap(BaseUtils.enemyMainBase().getPosition(),
+ // "Enemy MainBaseLocation");
+ // }
+ // if
+ // (InformationManager.Instance().getFirstChokePoint(PlayerUtils.enemyPlayer())
+ // != null) {
+ // Broodwar.drawTextMap(InformationManager.Instance().getFirstChokePoint(PlayerUtils.enemyPlayer()).getCenter(),
+ // "Enemy First ChokePoint");
+ // }
+ if (ChokeUtils.enemySecondChoke() != null) {
+ Broodwar.drawTextMap(ChokeUtils.enemySecondChoke().getCenter(), "Enemy Second ChokePoint");
+ }
+ if (BaseUtils.enemyFirstExpansion() != null) {
+ Broodwar.drawTextMap(BaseUtils.enemyFirstExpansion().getPosition(), "Enemy First ExpansionLocation");
+ }
+
+ }
+ }
+
+ /// Tile Position 그리드를 Map 에 표시합니다
+ public void drawMapGrid() {
+ int cellSize = MapGrid.Instance().getCellSize();
+ int mapWidth = MapGrid.Instance().getMapWidth();
+ int mapHeight = MapGrid.Instance().getMapHeight();
+ int rows = MapGrid.Instance().getRows();
+ int cols = MapGrid.Instance().getCols();
+
+ for (int i = 0; i < cols; i++) {
+ Broodwar.drawLineMap(i * cellSize, 0, i * cellSize, mapHeight, Color.Blue);
+ }
+
+ for (int j = 0; j < rows; j++) {
+ Broodwar.drawLineMap(0, j * cellSize, mapWidth, j * cellSize, Color.Blue);
+ }
+
+ for (int r = 0; r < rows; r += 2) {
+ for (int c = 0; c < cols; c += 2) {
+ Broodwar.drawTextMap(c * 32, r * 32, c + "," + r);
+ }
+ }
+ }
+
+ /// BuildOrderQueue 를 Screen 에 표시합니다
+ public void drawBuildOrderQueueOnScreen(int x, int y) {
+ Broodwar.drawTextScreen(x, y, white + " ");
+
+ Deque buildQueue = BuildManager.Instance().buildQueue.getQueue();
+ int itemCount = 0;
+
+ // C++ : for (std.deque.reverse_iterator itr =
+ // buildQueue.rbegin(); itr != buildQueue.rend(); itr++) {
+ // C++ : BuildOrderItem & currentItem = *itr;
+ // C++ : Monster.game.drawTextScreen(x, y + 10 + (itemCount * 10), "
+ // %s", currentItem.metaType.getName().c_str());
+ // C++ : itemCount++;
+ // C++ : if (itemCount >= 24) break;
+ // C++ : }
+
+ Object[] tempQueue = buildQueue.toArray();
+
+ for (int i = 0; i < tempQueue.length; i++) {
+ BuildOrderItem currentItem = (BuildOrderItem) tempQueue[i];
+ Broodwar.drawTextScreen(x, y + 10 + (itemCount * 10),
+ white + currentItem.metaType.getName() + " " + currentItem.blocking);
+ itemCount++;
+ if (itemCount >= 24)
+ break;
+ }
+ }
+
+ /// Build 진행 상태를 Screen 에 표시합니다
+ public void drawBuildStatusOnScreen(int x, int y) {
+ // 건설 / 훈련 중인 유닛 진행상황 표시
+ Vector unitsUnderConstruction = new Vector();
+ for (Unit unit : Broodwar.self().getUnits()) {
+ if (unit != null && unit.isBeingConstructed()) {
+ unitsUnderConstruction.add(unit);
+ }
+ }
+
+ // sort it based on the time it was started
+ Object[] tempArr = unitsUnderConstruction.toArray();
+ // Arrays.sort(tempArr);
+ unitsUnderConstruction = new Vector();
+ for (int i = 0; i < tempArr.length; i++) {
+ unitsUnderConstruction.add((Unit) tempArr[i]);
+ }
+ // C++ : std.sort(unitsUnderConstruction.begin(),
+ // unitsUnderConstruction.end(), CompareWhenStarted());
+
+ Broodwar.drawTextScreen(x, y, white + " ");
+
+ int reps = unitsUnderConstruction.size() < 10 ? unitsUnderConstruction.size() : 10;
+
+ for (Unit unit : unitsUnderConstruction) {
+ y += 10;
+ UnitType t = unit.getType();
+ if (t == UnitType.Zerg_Egg) {
+ t = unit.getBuildType();
+ }
+
+ Broodwar.drawTextScreen(x, y, "" + white + t + " (" + unit.getRemainingBuildTime() + ")");
+ }
+
+ // Tech Research 표시
+
+ // Upgrade 표시
+ }
+
+ /// Construction 을 하기 위해 예약해둔 Tile 들을 Map 에 표시합니다
+ public void drawReservedBuildingTilesOnMap() {
+ boolean[][] reserveMap = ConstructionPlaceFinder.Instance().getReserveMap();
+ if (reserveMap.length > 0 && reserveMap[0] != null && reserveMap[0].length > 0) {
+ int rwidth = reserveMap.length;
+ int rheight = reserveMap[0].length;
+
+ for (int x = 0; x < rwidth; ++x) {
+ for (int y = 0; y < rheight; ++y) {
+ if (reserveMap[x][y]) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Yellow, false);
+ }
+ }
+ }
+ }
+ }
+
+ /// Construction 을 하지 못하는 Tile 들을 Map 에 표시합니다
+ public void drawTilesToAvoidOnMap() {
+ int y = 0;
+ int x = 0;
+
+ for (y = 0; y < 128; y++) {
+ for (x = 0; x < 128; x++) {
+ if (ConstructionPlaceFinder.Instance().getTilesToAvoid(x, y)) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Orange, false);
+ }
+ //
+ }
+ }
+
+ for (y = 0; y < 128; y++) {
+ for (x = 0; x < 128; x++) {
+ if (ConstructionPlaceFinder.Instance().getTilesToAvoid(x, y)) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Orange, false);
+ }
+ if (ConstructionPlaceFinder.Instance().getTilesToAvoidAbsolute(x, y)) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Purple, false);
+ }
+ if (ConstructionPlaceFinder.Instance().getTilesToAvoidSupply(x, y)) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Red, false);
+ }
+
+ if (ConstructionPlaceFinder.Instance().getTilesToAvoidAddonBuilding(x, y)) {
+ int x1 = x * 32 + 8;
+ int y1 = y * 32 + 8;
+ int x2 = (x + 1) * 32 - 8;
+ int y2 = (y + 1) * 32 - 8;
+
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Black, false);
+ }
+ //
+ }
+ }
+ }
+
+ /// ConstructionQueue 를 Screen 에 표시합니다
+ public void drawConstructionQueueOnScreenAndMap(int x, int y) {
+ Broodwar.drawTextScreen(x, y, white + " ");
+
+ int yspace = 0;
+
+ Vector constructionQueue = ConstructionManager.Instance().getConstructionQueue();
+
+ for (final ConstructionTask b : constructionQueue) {
+ String constructionState = "";
+
+ if (b.getStatus() == ConstructionTask.ConstructionStatus.Unassigned.ordinal()) {
+ Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), "" + white + b.getType() + " - No Worker");
+ } else if (b.getStatus() == ConstructionTask.ConstructionStatus.Assigned.ordinal()) {
+ if (b.getConstructionWorker() == null) {
+ Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), b.getType() + " - Assigned Worker Null");
+ } else {
+ Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10),
+ b.getType() + " - Assigned Worker " + b.getConstructionWorker().getID() + ", Position ("
+ + b.getFinalPosition().getX() + "," + b.getFinalPosition().getY() + ")");
+ }
+
+ int x1 = b.getFinalPosition().getX() * 32;
+ int y1 = b.getFinalPosition().getY() * 32;
+ int x2 = (b.getFinalPosition().getX() + b.getType().tileWidth()) * 32;
+ int y2 = (b.getFinalPosition().getY() + b.getType().tileHeight()) * 32;
+
+ Broodwar.drawLineMap(b.getConstructionWorker().getPosition().getX(),
+ b.getConstructionWorker().getPosition().getY(), (x1 + x2) / 2, (y1 + y2) / 2, Color.Orange);
+ Broodwar.drawBoxMap(x1, y1, x2, y2, Color.Red, false);
+ } else if (b.getStatus() == ConstructionTask.ConstructionStatus.UnderConstruction.ordinal()) {
+ Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10),
+ "" + white + b.getType() + " - Under Construction");
+ }
+ yspace++;
+ }
+ }
+
+ /// Unit 의 Id 를 Map 에 표시합니다
+ public void drawUnitIdOnMap() {
+ for (Unit unit : Broodwar.self().getUnits()) {
+ Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + white + unit.getID());
+ }
+ for (Unit unit : Broodwar.enemy().getUnits()) {
+ Broodwar.drawTextMap(unit.getPosition().getX(), unit.getPosition().getY() + 5, "" + white + unit.getID());
+ }
+ }
+
+ /// Worker Unit 들의 상태를 Screen 에 표시합니다
+ public void drawWorkerStateOnScreen(int x, int y) {
+ WorkerData workerData = WorkerManager.Instance().getWorkerData();
+
+ Broodwar.drawTextScreen(x, y, white + "");
+
+ int yspace = 0;
+
+ for (Unit unit : workerData.getWorkers()) {
+ if (unit == null)
+ continue;
+
+ // Mineral / Gas / Idle Worker 는 표시 안한다
+ if (workerData.getJobCode(unit) == 'M' || workerData.getJobCode(unit) == 'I'
+ || workerData.getJobCode(unit) == 'G') {
+ continue;
+ }
+
+ Broodwar.drawTextScreen(x, y + 10 + ((yspace) * 10), white + " " + unit.getID());
+
+ if (workerData.getJobCode(unit) == 'B') {
+ Broodwar.drawTextScreen(x + 30, y + 10 + ((yspace++) * 10),
+ white + " " + workerData.getJobCode(unit) + " " + unit.getBuildType() + " "
+ + (unit.isConstructing() ? 'Y' : 'N') + " (" + unit.getTilePosition().getX() + ", "
+ + unit.getTilePosition().getY() + ")");
+ } else {
+ Broodwar.drawTextScreen(x + 30, y + 10 + ((yspace++) * 10), white + " " + workerData.getJobCode(unit));
+ }
+ }
+ }
+
+ /// ResourceDepot 별 Worker 숫자를 Map 에 표시합니다
+ public void drawWorkerCountOnMap() {
+ for (Unit depot : WorkerManager.Instance().getWorkerData().getDepots()) {
+ if (depot == null)
+ continue;
+
+ int x = depot.getPosition().getX() - 64;
+ int y = depot.getPosition().getY() - 32;
+
+ Broodwar.drawBoxMap(x - 2, y - 1, x + 75, y + 14, Color.Black, true);
+ Broodwar.drawTextMap(x, y,
+ white + " Workers: " + WorkerManager.Instance().getWorkerData().getNumAssignedWorkers(depot));
+ }
+ }
+
+ /// Worker Unit 의 자원채취 현황을 Map 에 표시합니다
+ public void drawWorkerMiningStatusOnMap() {
+ WorkerData workerData = WorkerManager.Instance().getWorkerData();
+
+ for (Unit worker : workerData.getWorkers()) {
+ if (worker == null)
+ continue;
+
+ Position pos = worker.getTargetPosition();
+
+ Broodwar.drawTextMap(worker.getPosition().getX(), worker.getPosition().getY() - 5,
+ "" + white + workerData.getJobCode(worker));
+
+ Broodwar.drawLineMap(worker.getPosition().getX(), worker.getPosition().getY(), pos.getX(), pos.getY(),
+ Color.Cyan);
/*
- // ResourceDepot ~ Worker 사이에 직선 표시
- BWAPI.Unit depot = workerData.getWorkerDepot(worker);
- if (depot) {
- Monster.game.drawLineMap(worker.getPosition().x, worker.getPosition().y, depot.getPosition().x, depot.getPosition().y, Color.Orange);
- }
- */
- }
- }
-
- /// Unit 의 Target 으로 잇는 선을 Map 에 표시합니다
- public void drawUnitTargetOnMap() {
- for (Unit unit : Broodwar.self().getUnits()) {
- if (unit != null && unit.isCompleted() && !unit.getType().isBuilding() && !unit.getType().isWorker()) {
- Unit targetUnit = unit.getTarget();
- if (targetUnit != null && targetUnit.getPlayer() != Broodwar.self()) {
- Broodwar.drawCircleMap(unit.getPosition(), dotRadius, Color.Red, true);
- Broodwar.drawCircleMap(targetUnit.getTargetPosition(), dotRadius, Color.Red, true);
- Broodwar.drawLineMap(unit.getPosition(), targetUnit.getTargetPosition(), Color.Red);
- } else if (unit.isMoving()) {
- Broodwar.drawCircleMap(unit.getPosition(), dotRadius, Color.Orange, true);
- Broodwar.drawCircleMap(unit.getTargetPosition(), dotRadius, Color.Orange, true);
- Broodwar.drawLineMap(unit.getPosition(), unit.getTargetPosition(), Color.Orange);
- }
-
- }
- }
- }
-
- /// Bullet 을 Map 에 표시합니다
- /// Cloaking Unit 의 Bullet 표시에 쓰입니다
- public void drawBulletsOnMap() {
- for (Bullet b : Broodwar.getBullets()) {
- Position p = b.getPosition();
- double velocityX = b.getVelocityX();
- double velocityY = b.getVelocityY();
-
- if (b.getType() == BulletType.Acid_Spore) bulletTypeName = "Acid_Spore";
- else if (b.getType() == BulletType.Anti_Matter_Missile) bulletTypeName = "Anti_Matter_Missile";
- else if (b.getType() == BulletType.Arclite_Shock_Cannon_Hit) bulletTypeName = "Arclite_Shock_Cannon_Hit";
- else if (b.getType() == BulletType.ATS_ATA_Laser_Battery) bulletTypeName = "ATS_ATA_Laser_Battery";
- else if (b.getType() == BulletType.Burst_Lasers) bulletTypeName = "Burst_Lasers";
- else if (b.getType() == BulletType.C_10_Canister_Rifle_Hit) bulletTypeName = "C_10_Canister_Rifle_Hit";
- else if (b.getType() == BulletType.Consume) bulletTypeName = "Consume";
- else if (b.getType() == BulletType.Corrosive_Acid_Shot) bulletTypeName = "Corrosive_Acid_Shot";
- else if (b.getType() == BulletType.Dual_Photon_Blasters_Hit) bulletTypeName = "Dual_Photon_Blasters_Hit";
- else if (b.getType() == BulletType.EMP_Missile) bulletTypeName = "EMP_Missile";
- else if (b.getType() == BulletType.Ensnare) bulletTypeName = "Ensnare";
- else if (b.getType() == BulletType.Fragmentation_Grenade) bulletTypeName = "Fragmentation_Grenade";
- else if (b.getType() == BulletType.Fusion_Cutter_Hit) bulletTypeName = "Fusion_Cutter_Hit";
- else if (b.getType() == BulletType.Gauss_Rifle_Hit) bulletTypeName = "Gauss_Rifle_Hit";
- else if (b.getType() == BulletType.Gemini_Missiles) bulletTypeName = "Gemini_Missiles";
- else if (b.getType() == BulletType.Glave_Wurm) bulletTypeName = "Glave_Wurm";
- else if (b.getType() == BulletType.Halo_Rockets) bulletTypeName = "Halo_Rockets";
- else if (b.getType() == BulletType.Invisible) bulletTypeName = "Invisible";
- else if (b.getType() == BulletType.Longbolt_Missile) bulletTypeName = "Longbolt_Missile";
- else if (b.getType() == BulletType.Melee) bulletTypeName = "Melee";
- else if (b.getType() == BulletType.Needle_Spine_Hit) bulletTypeName = "Needle_Spine_Hit";
- else if (b.getType() == BulletType.Neutron_Flare) bulletTypeName = "Neutron_Flare";
- else if (b.getType() == BulletType.None) bulletTypeName = "None";
- else if (b.getType() == BulletType.Optical_Flare_Grenade) bulletTypeName = "Optical_Flare_Grenade";
- else if (b.getType() == BulletType.Particle_Beam_Hit) bulletTypeName = "Particle_Beam_Hit";
- else if (b.getType() == BulletType.Phase_Disruptor) bulletTypeName = "Phase_Disruptor";
- else if (b.getType() == BulletType.Plague_Cloud) bulletTypeName = "Plague_Cloud";
- else if (b.getType() == BulletType.Psionic_Shockwave_Hit) bulletTypeName = "Psionic_Shockwave_Hit";
- else if (b.getType() == BulletType.Psionic_Storm) bulletTypeName = "Psionic_Storm";
- else if (b.getType() == BulletType.Pulse_Cannon) bulletTypeName = "Pulse_Cannon";
- else if (b.getType() == BulletType.Queen_Spell_Carrier) bulletTypeName = "Queen_Spell_Carrier";
- else if (b.getType() == BulletType.Seeker_Spores) bulletTypeName = "Seeker_Spores";
- else if (b.getType() == BulletType.STA_STS_Cannon_Overlay) bulletTypeName = "STA_STS_Cannon_Overlay";
- else if (b.getType() == BulletType.Subterranean_Spines) bulletTypeName = "Subterranean_Spines";
- else if (b.getType() == BulletType.Sunken_Colony_Tentacle) bulletTypeName = "Sunken_Colony_Tentacle";
- else if (b.getType() == BulletType.Unknown) bulletTypeName = "Unknown";
- else if (b.getType() == BulletType.Yamato_Gun) bulletTypeName = "Yamato_Gun";
-
- // 아군 것이면 녹색, 적군 것이면 빨간색
- Broodwar.drawLineMap(p, new Position(p.getX() + (int) velocityX, p.getY() + (int) velocityY), b.getPlayer() == Broodwar.self() ? Color.Green : Color.Red);
- if (b.getType() != null) {
- Broodwar.drawTextMap(p, (b.getPlayer() == Broodwar.self() ? "" + teal : "" + red) + bulletTypeName);
- }
- }
- }
+ * // ResourceDepot ~ Worker 사이에 직선 표시 BWAPI.Unit depot =
+ * workerData.getWorkerDepot(worker); if (depot) {
+ * Monster.game.drawLineMap(worker.getPosition().x,
+ * worker.getPosition().y, depot.getPosition().x,
+ * depot.getPosition().y, Color.Orange); }
+ */
+ }
+ }
+
+ /// Unit 의 Target 으로 잇는 선을 Map 에 표시합니다
+ public void drawUnitTargetOnMap() {
+ for (Unit unit : Broodwar.self().getUnits()) {
+ if (unit != null && unit.isCompleted() && !unit.getType().isBuilding() && !unit.getType().isWorker()) {
+ Unit targetUnit = unit.getTarget();
+ if (targetUnit != null && targetUnit.getPlayer() != Broodwar.self()) {
+ Broodwar.drawCircleMap(unit.getPosition(), dotRadius, Color.Red, true);
+ Broodwar.drawCircleMap(targetUnit.getTargetPosition(), dotRadius, Color.Red, true);
+ Broodwar.drawLineMap(unit.getPosition(), targetUnit.getTargetPosition(), Color.Red);
+ } else if (unit.isMoving()) {
+ Broodwar.drawCircleMap(unit.getPosition(), dotRadius, Color.Orange, true);
+ Broodwar.drawCircleMap(unit.getTargetPosition(), dotRadius, Color.Orange, true);
+ Broodwar.drawLineMap(unit.getPosition(), unit.getTargetPosition(), Color.Orange);
+ }
+
+ }
+ }
+ }
+
+ /// Bullet 을 Map 에 표시합니다
+ /// Cloaking Unit 의 Bullet 표시에 쓰입니다
+ public void drawBulletsOnMap() {
+ for (Bullet b : Broodwar.getBullets()) {
+ Position p = b.getPosition();
+ double velocityX = b.getVelocityX();
+ double velocityY = b.getVelocityY();
+
+ if (b.getType() == BulletType.Acid_Spore)
+ bulletTypeName = "Acid_Spore";
+ else if (b.getType() == BulletType.Anti_Matter_Missile)
+ bulletTypeName = "Anti_Matter_Missile";
+ else if (b.getType() == BulletType.Arclite_Shock_Cannon_Hit)
+ bulletTypeName = "Arclite_Shock_Cannon_Hit";
+ else if (b.getType() == BulletType.ATS_ATA_Laser_Battery)
+ bulletTypeName = "ATS_ATA_Laser_Battery";
+ else if (b.getType() == BulletType.Burst_Lasers)
+ bulletTypeName = "Burst_Lasers";
+ else if (b.getType() == BulletType.C_10_Canister_Rifle_Hit)
+ bulletTypeName = "C_10_Canister_Rifle_Hit";
+ else if (b.getType() == BulletType.Consume)
+ bulletTypeName = "Consume";
+ else if (b.getType() == BulletType.Corrosive_Acid_Shot)
+ bulletTypeName = "Corrosive_Acid_Shot";
+ else if (b.getType() == BulletType.Dual_Photon_Blasters_Hit)
+ bulletTypeName = "Dual_Photon_Blasters_Hit";
+ else if (b.getType() == BulletType.EMP_Missile)
+ bulletTypeName = "EMP_Missile";
+ else if (b.getType() == BulletType.Ensnare)
+ bulletTypeName = "Ensnare";
+ else if (b.getType() == BulletType.Fragmentation_Grenade)
+ bulletTypeName = "Fragmentation_Grenade";
+ else if (b.getType() == BulletType.Fusion_Cutter_Hit)
+ bulletTypeName = "Fusion_Cutter_Hit";
+ else if (b.getType() == BulletType.Gauss_Rifle_Hit)
+ bulletTypeName = "Gauss_Rifle_Hit";
+ else if (b.getType() == BulletType.Gemini_Missiles)
+ bulletTypeName = "Gemini_Missiles";
+ else if (b.getType() == BulletType.Glave_Wurm)
+ bulletTypeName = "Glave_Wurm";
+ else if (b.getType() == BulletType.Halo_Rockets)
+ bulletTypeName = "Halo_Rockets";
+ else if (b.getType() == BulletType.Invisible)
+ bulletTypeName = "Invisible";
+ else if (b.getType() == BulletType.Longbolt_Missile)
+ bulletTypeName = "Longbolt_Missile";
+ else if (b.getType() == BulletType.Melee)
+ bulletTypeName = "Melee";
+ else if (b.getType() == BulletType.Needle_Spine_Hit)
+ bulletTypeName = "Needle_Spine_Hit";
+ else if (b.getType() == BulletType.Neutron_Flare)
+ bulletTypeName = "Neutron_Flare";
+ else if (b.getType() == BulletType.None)
+ bulletTypeName = "None";
+ else if (b.getType() == BulletType.Optical_Flare_Grenade)
+ bulletTypeName = "Optical_Flare_Grenade";
+ else if (b.getType() == BulletType.Particle_Beam_Hit)
+ bulletTypeName = "Particle_Beam_Hit";
+ else if (b.getType() == BulletType.Phase_Disruptor)
+ bulletTypeName = "Phase_Disruptor";
+ else if (b.getType() == BulletType.Plague_Cloud)
+ bulletTypeName = "Plague_Cloud";
+ else if (b.getType() == BulletType.Psionic_Shockwave_Hit)
+ bulletTypeName = "Psionic_Shockwave_Hit";
+ else if (b.getType() == BulletType.Psionic_Storm)
+ bulletTypeName = "Psionic_Storm";
+ else if (b.getType() == BulletType.Pulse_Cannon)
+ bulletTypeName = "Pulse_Cannon";
+ else if (b.getType() == BulletType.Queen_Spell_Carrier)
+ bulletTypeName = "Queen_Spell_Carrier";
+ else if (b.getType() == BulletType.Seeker_Spores)
+ bulletTypeName = "Seeker_Spores";
+ else if (b.getType() == BulletType.STA_STS_Cannon_Overlay)
+ bulletTypeName = "STA_STS_Cannon_Overlay";
+ else if (b.getType() == BulletType.Subterranean_Spines)
+ bulletTypeName = "Subterranean_Spines";
+ else if (b.getType() == BulletType.Sunken_Colony_Tentacle)
+ bulletTypeName = "Sunken_Colony_Tentacle";
+ else if (b.getType() == BulletType.Unknown)
+ bulletTypeName = "Unknown";
+ else if (b.getType() == BulletType.Yamato_Gun)
+ bulletTypeName = "Yamato_Gun";
+
+ // 아군 것이면 녹색, 적군 것이면 빨간색
+ Broodwar.drawLineMap(p, new Position(p.getX() + (int) velocityX, p.getY() + (int) velocityY),
+ b.getPlayer() == Broodwar.self() ? Color.Green : Color.Red);
+ if (b.getType() != null) {
+ Broodwar.drawTextMap(p, (b.getPlayer() == Broodwar.self() ? "" + teal : "" + red) + bulletTypeName);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/monster/debugger/chat/ChatBot.java b/src/main/java/org/monster/debugger/chat/ChatBot.java
index e3c20e9..299df27 100644
--- a/src/main/java/org/monster/debugger/chat/ChatBot.java
+++ b/src/main/java/org/monster/debugger/chat/ChatBot.java
@@ -1,9 +1,11 @@
package org.monster.debugger.chat;
import bwapi.Game;
+
import org.monster.debugger.chat.impl.GameSpeedAdjuster;
import org.monster.debugger.chat.impl.StrategyChanger;
import org.monster.debugger.chat.impl.StrikeLevelAdjuster;
+import org.monster.debugger.chat.impl.UxListAddMinus;
import org.monster.debugger.chat.impl.UxOptionChanger;
import java.util.ArrayList;
@@ -16,10 +18,13 @@ public class ChatBot {
/*****************************************************************************
* 설명
*
- * 1) 게임스피드 조절 : s + 숫자 ex) s0=매우빠름, s24=bot경기스피드, s42=fastest
- * 2) UX 타입 변경 : d + 숫자 ex) d1=?, d0=prebot1 display
- * 3) 전략 변경 : $ + 전략명 ex) $TERRAN INIT
- * 4) 레이쓰 공격레벨 변경 : w + 숫자 ex) w1
+ * 1) 게임스피드 조절 : s + 숫자 ex) s0=매우빠름, s24=bot경기스피드, s42=fastest
+ * 2) UX 타입 변경 : d + 숫자 ex) d1=?, d0=prebot1 display
+ * 3) 전략 변경 : $ + 전략명 ex) $TERRAN INIT
+ * 4) 레이쓰 공격레벨 변경 : w + 숫자 ex) w1
+ * 5) 디버깅 변수 추가 : a + class + 변수 ex) a L strategyBoard startStrategy
+ * 5) 디버깅 변수 제거 : m + 변수이름 ex) m startStrategy
+ * 6) 디버깅 초기화
*
*****************************************************************************/
static {
@@ -27,6 +32,8 @@ public class ChatBot {
chatExecuters.add(new UxOptionChanger('d'));
chatExecuters.add(new StrategyChanger('$'));
chatExecuters.add(new StrikeLevelAdjuster('w'));
+ chatExecuters.add(new UxListAddMinus('a'));
+ chatExecuters.add(new UxListAddMinus('m'));
}
public static void addChatExecuter(ChatExecuter chatExecuter) {
@@ -45,10 +52,10 @@ public static void operateChatBot(String command) {
char type = command.charAt(0);
String option = command.substring(1);
-
+
for (ChatExecuter executer : chatExecuters) {
if (executer.isExecuteCharacter(type)) {
- executer.execute(option);
+ executer.execute(option);
break;
}
}
diff --git a/src/main/java/org/monster/debugger/chat/ChatExecuter.java b/src/main/java/org/monster/debugger/chat/ChatExecuter.java
index 51e2499..2018d3d 100644
--- a/src/main/java/org/monster/debugger/chat/ChatExecuter.java
+++ b/src/main/java/org/monster/debugger/chat/ChatExecuter.java
@@ -8,8 +8,12 @@ public abstract class ChatExecuter {
public ChatExecuter(char ch) {
this.type = Character.toLowerCase(ch);
}
+
+ public char getType() {
+ return type;
+ }
- public boolean isExecuteCharacter(char ch) {
+ public boolean isExecuteCharacter(char ch) {
return this.type == Character.toLowerCase(ch);
}
diff --git a/src/main/java/org/monster/debugger/chat/impl/UxDrawConfig.java b/src/main/java/org/monster/debugger/chat/impl/UxDrawConfig.java
new file mode 100644
index 0000000..0a2408f
--- /dev/null
+++ b/src/main/java/org/monster/debugger/chat/impl/UxDrawConfig.java
@@ -0,0 +1,183 @@
+package org.monster.debugger.chat.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.monster.board.StrategyBoard;
+import org.monster.worker.WorkerManager;
+
+public class UxDrawConfig {
+
+ static Map> classMap = new HashMap<>();
+ static {
+ classMap.put("STRATEGYBOARD", StrategyBoard.class);
+ classMap.put("WORKERMANAGER", WorkerManager.class);
+ }
+
+ public static Map posMap = new HashMap<>();
+ static {
+ posMap.put("L", 20);
+ posMap.put("M", 250);
+ posMap.put("R", 500);
+
+ }
+
+ private char color;
+ private Class> clazz;
+ private Method method;
+
+ public Method getMethod() {
+ return method;
+ }
+
+ private Field field;
+ // private Field field;
+
+ public Field getField() {
+ return field;
+ }
+
+ private int pos = posMap.get("L");
+
+ public void setPos(int pos) {
+ this.pos = pos;
+ }
+
+ public int getPos() {
+ return pos;
+ }
+
+ private String key;
+ private Object value;
+
+ public char getColor() {
+ return color;
+ }
+
+ public void setColor(char color) {
+ this.color = color;
+ }
+
+ public UxDrawConfig(String pos, String key, Class> clazz, Method method, char color) {
+ this.pos = posMap.get(pos.toUpperCase());
+ this.key = key;
+ this.clazz = clazz;
+ this.method = method;
+ this.color = color;
+ // TODO Auto-generated constructor stub
+ }
+
+ public UxDrawConfig(String pos, String key, Class> clazz, Field field, char color) {
+ this.pos = posMap.get(pos.toUpperCase());
+ this.key = key;
+ this.clazz = clazz;
+ this.field = field;
+ this.color = color;
+ // TODO Auto-generated constructor stub
+ }
+
+ public UxDrawConfig(String pos, String key, Object value, char color) {
+ this.pos = posMap.get(pos.toUpperCase());
+ this.key = key;
+ this.value = value;
+ this.color = color;
+ // TODO Auto-generated constructor stub
+ }
+
+ public UxDrawConfig(String pos, String key, int value, char color) {
+ this.pos = posMap.get(pos.toUpperCase());
+ this.key = key;
+ this.value = value;
+ this.color = color;
+ // TODO Auto-generated constructor stub
+ }
+
+ public static UxDrawConfig newInstanceFiledType(String pos, String key, Class> clazz, String field, char color) {
+ Class> c = clazz.getClass();
+ Field fld = null;
+ try {
+ fld = c.getDeclaredField(field);
+ if (!fld.isAccessible()) {
+ fld.setAccessible(true);
+ }
+ } catch (Exception e) {
+ // System.out.println(e.getMessage());
+ }
+ System.out.println(fld.getName().toString());
+ return new UxDrawConfig(pos, key, c, fld, color);
+ }
+
+ public static UxDrawConfig newInstanceMethodType(String pos, String key, Class> clazz, String method,
+ char color) {
+ Method invokeMethod = null;
+ try {
+ invokeMethod = clazz.getDeclaredMethod(method);
+ if (!invokeMethod.isAccessible()) {
+ invokeMethod.setAccessible(true);
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return new UxDrawConfig(pos, key, clazz, invokeMethod, color);
+ }
+
+
+ public static UxDrawConfig newInstanceStringType(String pos, String key, Object value, char color) {
+
+ return new UxDrawConfig(pos, key, value, color);
+ }
+
+
+ public String getClassFieldName() {
+ if (clazz != null) {
+ if (method != null) {
+ try {
+ return this.key + " : " + this.method.invoke(clazz).toString();
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } else if (field != null) {
+ return this.key + " : " + this.field.getName().toString();
+ }
+ } else if (this.key.equals("")) {
+ return this.value.toString();
+ } else {
+ return this.key + " : " + this.value.toString();
+ }
+ return key;
+ }
+
+ public String getFieldName() {
+ if (this.field == null) {
+ return "";
+ } else {
+ return field.toString();
+ }
+ }
+
+ public String getValue() {
+ if (this.value == null) {
+ return "";
+ } else {
+ return value.toString();
+ }
+ }
+
+ public Class> getClazz() {
+ return this.clazz;
+ }
+
+ public String getKey() {
+ return this.key;
+ }
+
+ public void setClazz(String className) {
+ this.clazz = classMap.get(className.toUpperCase());
+ }
+
+};
\ No newline at end of file
diff --git a/src/main/java/org/monster/debugger/chat/impl/UxListAddMinus.java b/src/main/java/org/monster/debugger/chat/impl/UxListAddMinus.java
new file mode 100644
index 0000000..8cb736c
--- /dev/null
+++ b/src/main/java/org/monster/debugger/chat/impl/UxListAddMinus.java
@@ -0,0 +1,39 @@
+package org.monster.debugger.chat.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.monster.board.StrategyBoard;
+import org.monster.debugger.PreBotUXManager;
+import org.monster.debugger.UxColor;
+import org.monster.debugger.chat.ChatExecuter;
+
+public class UxListAddMinus extends ChatExecuter {
+ public UxListAddMinus(char type) {
+ super(type);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void execute(String option) {
+ // TODO Auto-generated method stub
+ if('a' == getType()){
+ String pos = option.split(" ")[1];
+ String key = option.split(" ")[2];
+ String value = option.split(" ")[3];
+
+ UxDrawConfig ux = UxDrawConfig.newInstanceFiledType(pos,key,UxDrawConfig.classMap.get(key.toUpperCase()),value,UxColor.CHAR_GREEN);
+ PreBotUXManager.Instance().drawStrategyListOrigin[PreBotUXManager.Instance().getUxOption()].add(ux);
+ }else if('m' == getType()){
+ for (UxDrawConfig drawList : PreBotUXManager.Instance().drawStrategyListOrigin[PreBotUXManager.Instance().getUxOption()]) {
+ if(drawList.getFieldName().equals(option.split(" ")[1])
+ || drawList.getValue().equals(option.split(" ")[1])){
+ PreBotUXManager.Instance().drawStrategyListOrigin[PreBotUXManager.Instance().getUxOption()].remove(drawList);
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/src/main/java/org/monster/debugger/readme.md b/src/main/java/org/monster/debugger/readme.md
new file mode 100644
index 0000000..c92c498
--- /dev/null
+++ b/src/main/java/org/monster/debugger/readme.md
@@ -0,0 +1,22 @@
+#debugging 사용법
+
+1.구조
+*PreBouUxmanager.java 에 필요한 정보 추가 후 ScreenUx.java 에서 메소드 호출.
+*화면 상에서 Left, Mid, Right 에 정보 표시 가능.
+*UxDrawConfig 객체 생성 후 정적 팩토리 메서드 호출.
+*String, Field, Method 로 호출 가능
+
+
+2.사용
+*출력하고자 하는 값일 String 일 경우 newInstanceStringType(위치,타이틀,값,칼라)->
+uxDrawConfig = UxDrawConfig.newInstanceStringType("L", "reaverInMyBaseFrame",
+ DrawingUtils.framesToTimeString(EnemyBuildTimer.Instance().reaverInMyBaseFrame), UxColor.CHAR_WHITE);
+
+*출력하고자 하는 값일 Field 일 경우 newInstanceFiledType(위치,타이틀,클래스,field,칼라)->
+newInstanceFiledType("M",key,UxDrawConfig.classMap.get(key.toUpperCase()),value,UxColor.CHAR_GREEN)
+
+*출력하고자 하는 값일 Method 일 경우 newInstanceFiledType(위치,타이틀,클래스,method명,칼라)->
+newInstanceMethodType("R", "* group size", LagObserver.class, "groupsize",UxColor.CHAR_WHITE);
+
+
+
\ No newline at end of file