diff --git a/java/src/s2/Tower.java b/java/src/s2/Tower.java index f8ea2d3..ea005f5 100644 --- a/java/src/s2/Tower.java +++ b/java/src/s2/Tower.java @@ -44,6 +44,18 @@ public void run() throws GameActionException { // break; // Spawn only one soldier // } // } + MapInfo[] infos = rc.senseNearbyMapInfos(-1); + RobotInfo[] nearbyEnemies = rc.senseNearbyRobots(-1, rc.getTeam().opponent()); + + int e_count = 0; + for (MapInfo mapInfo: infos) { + if (mapInfo.getPaint().isEnemy()) { + e_count++; + } + } + if (e_count>35 || nearbyEnemies.length > 3) { + rtype = 2; + } // Pick a direction to build in. Direction dir = directions[rng.nextInt(directions.length)]; @@ -64,7 +76,7 @@ public void run() throws GameActionException { if (spawn_count[rtype] >= target_count[rtype]) { rtype++; } - if (rtype > 2) { + if (rtype == 2) { rtype = 0; spawn_count[0] = 0; spawn_count[1] = 0; @@ -83,7 +95,6 @@ public void run() throws GameActionException { } // Attack logic for Tower - RobotInfo[] nearbyEnemies = rc.senseNearbyRobots(-1, rc.getTeam().opponent()); // Perform Single Target Attack on the lowest HP priority target if (nearbyEnemies.length > 0) {