diff --git a/RobotPlayer.java b/RobotPlayer.java index 58959c0..3090927 100644 --- a/RobotPlayer.java +++ b/RobotPlayer.java @@ -141,8 +141,11 @@ public void run() { * */ private class Guard { + + public MapLocation startLocation; public Guard() { + startLocation = rc.getLocation(); } public void run() { @@ -178,6 +181,28 @@ public void run() { break; } } + //If didn't attack anyone that is adjacent + if(rc.isWeaponReady()){ + MapLocation target = null; + for(RobotInfo robot: robots) { + if((robot.team == Team.ZOMBIE) && robot.location.distanceSquaredTo(startLocation) < 25) { + target = robot.location; + break; + } + } + for(RobotInfo robot: robots) { + if((robot.team == opponentTeam) && robot.location.distanceSquaredTo(startLocation) < 25) { + System.out.println("pikachu"); + target = robot.location; + break; + } + } + if(target != null){ + System.out.println("target found"); + RESOURCE_FUNCTIONS.BUG(target); + System.out.println("Still alive"); + } + } } Clock.yield(); }catch(Exception e){