public void AffectNearbyAIs(HackGameBoard board) { HackGameAgent[] agents = board.GetAgents(); for (int i = 0; i < agents.Length; i++) { if (agents[i] is HackGameAgent_AI && agents[i].GetCurrentState() == HackGameAgent_State.HackGameAgent_State_Active) { if ((agents[i].getCurrentBoardLocation() == getCurrentBoardLocation() && agents[i].getTtoDestination() < multimissileSplashDamageThreshhold) || (agents[i].getDestinationBoardLocation() == getCurrentBoardLocation() && agents[i].getTtoDestination() > 1.0 - multimissileSplashDamageThreshhold)) { agents[i].Kill(0); board.AddBackgroundTextAward(new StringBuilder("000000 000000 000000 00 00"), 0); board.AddBackgroundTextAward(new StringBuilder("0 0 0 0 0 0 0 00 0"), 0.1f); board.AddBackgroundTextAward(new StringBuilder("00000 0 0 0 0 0 0"), 0.1f); board.AddBackgroundTextAward(new StringBuilder("0 0 0 0 0 0 0 0"), 0.1f); board.AddBackgroundTextAward(new StringBuilder("000000 000000 000000 0 0"), 0.1f); } } } }
private HackGameAgent PickClosestTarget(HackGameBoard ourBoard) { int maxdistance = int.MaxValue; int checkdist = 0; HackGameAgent currentTarget = null; Point playerLoc = ourBoard.GetPlayer().getCurrentBoardLocation(); HackGameAgent[] targets = ourBoard.GetAgents(); for (int i = 0; i < targets.Length; i++) { if (targets[i] is HackGameAgent_AI) { checkdist = GetLengthToDestination(getCurrentBoardLocation(), targets[i].getCurrentBoardLocation(), ourBoard); if (checkdist != -1 && checkdist < maxdistance) { maxdistance = checkdist; currentTarget = targets[i]; } } } return currentTarget; }