From 02b0f3820dbcdd26128de97053126929d0493951 Mon Sep 17 00:00:00 2001 From: CoffeeCoder1015 Date: Mon, 20 Jan 2025 15:16:09 +1300 Subject: [PATCH 1/2] Makes towers favor mopper spawning when there are enemies in the area or enemy tiles --- java/src/s2/Tower.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/java/src/s2/Tower.java b/java/src/s2/Tower.java index f8ea2d3..67a0f6c 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>10 || 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) { From ae4c3739e07b6b618a22ca70578898d95c31f97c Mon Sep 17 00:00:00 2001 From: CoffeeCoder1015 Date: Mon, 20 Jan 2025 15:20:13 +1300 Subject: [PATCH 2/2] upping the threshold --- java/src/s2/Tower.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/s2/Tower.java b/java/src/s2/Tower.java index 67a0f6c..ea005f5 100644 --- a/java/src/s2/Tower.java +++ b/java/src/s2/Tower.java @@ -53,7 +53,7 @@ public void run() throws GameActionException { e_count++; } } - if (e_count>10 || nearbyEnemies.length > 3) { + if (e_count>35 || nearbyEnemies.length > 3) { rtype = 2; }