/* * If there are no good moves we should stay and fight */ private static void doRetreatMove() { try { if (myType == RobotType.COMMANDER && rc.hasLearnedSkill(CommanderSkillType.FLASH) && rc.getFlashCooldown() == 0) flashTowards(myHQ, true); Direction d = myLoc.directionTo(myHQ); rc.setIndicatorString(2, "Threatened - retreating towards HQ " + d); if (rc.isCoreReady()) tryMove(d, false); } catch (GameActionException e) { System.out.println("Retreat exception"); // e.printStackTrace(); } }
// Move towards enemy HQ if we can attack private static void doAdvanceMove() { try { if (myType == RobotType.COMMANDER && rc.hasLearnedSkill(CommanderSkillType.FLASH) && rc.getFlashCooldown() == 0) flashTowards(threats.enemyHQ, false); } catch (GameActionException e) { System.out.println("Flash exception"); // e.printStackTrace(); } if (rc.isCoreReady()) { Direction dir = null; if (myType.canAttack() || (myType == RobotType.LAUNCHER && Clock.getRoundNum() > 550)) { if (myType != RobotType.DRONE) dir = bfs.readResult(myLoc, threats.enemyHQ); if (dir == null) dir = myLoc.directionTo(threats.enemyHQ); rc.setIndicatorString(2, "Advancing " + dir); } else { dir = myLoc.directionTo(myHQ); rc.setIndicatorString(2, "HQ Defensive unit " + dir); } tryMove(dir, false); } }