From c1e4dca012cddf6ffac614d33fb51fcd5d54ecd0 Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 29 Jan 2019 18:20:40 +1300 Subject: [PATCH] home --- enemyAI/combatManagerAI.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/enemyAI/combatManagerAI.java b/enemyAI/combatManagerAI.java index 3410346..d911506 100644 --- a/enemyAI/combatManagerAI.java +++ b/enemyAI/combatManagerAI.java @@ -196,6 +196,17 @@ public class combatManagerAI { } }else { + //if the player is attacking and AI doesn't have enough unit to deal with it for the time being, hold attacks until AI has gathered enough force + if(mainThread.ec.theDefenseManagerAI.majorThreatLocation.x != 0) { + int numberOfLightTanks_AI = mainThread.ec.theUnitProductionAI.numberOfLightTanksControlledByCombatAI; + int numberOfRocketTanks_AI = mainThread.ec.theUnitProductionAI.numberOfRocketTanksControlledByCombatAI; + int numberOfStealthTanks_AI = mainThread.ec.theUnitProductionAI.numberOfStealthTanksControlledByCombatAI; + int numberOfHeavyTanks_AI = mainThread.ec.theUnitProductionAI.numberOfHeavyTanksControlledByCombatAI; + if(numberOfLightTanks_AI + numberOfRocketTanks_AI + numberOfStealthTanks_AI + numberOfHeavyTanks_AI < 7) + return; + } + + //check if there are any player units/structures near the combat center solidObject[] playerUnitInMinimap = mainThread.ec.theMapAwarenessAI.playerUnitInMinimap; solidObject[] playerStructures = mainThread.ec.theMapAwarenessAI.playerStructures;