diff --git a/enemyAI/combatManagerAI.java b/enemyAI/combatManagerAI.java index 73a4a62..819c854 100644 --- a/enemyAI/combatManagerAI.java +++ b/enemyAI/combatManagerAI.java @@ -121,7 +121,6 @@ public class combatManagerAI { combatCenterZ = mainThread.ec.theUnitProductionAI.combatAICenterZ; - if(Float.isNaN(combatCenterX) || Float.isNaN(combatCenterZ)) { // combatCenterX = 0; // combatCenterZ= 0; @@ -141,8 +140,6 @@ public class combatManagerAI { } - System.out.println(frameAI); - int numberOfLightTanks_AI = mainThread.ec.theUnitProductionAI.numberOfLightTanksControlledByCombatAI; int numberOfRocketTanks_AI = mainThread.ec.theUnitProductionAI.numberOfRocketTanksControlledByCombatAI; int numberOfStealthTanks_AI = mainThread.ec.theUnitProductionAI.numberOfStealthTanksControlledByCombatAI; diff --git a/enemyAI/mapAwarenessAI.java b/enemyAI/mapAwarenessAI.java index 67a0207..7776c50 100644 --- a/enemyAI/mapAwarenessAI.java +++ b/enemyAI/mapAwarenessAI.java @@ -4,6 +4,7 @@ import core.AssetManager; import core.baseInfo; import core.mainThread; import entity.goldMine; +import entity.harvester; import entity.solidObject; import core.vector; @@ -50,6 +51,7 @@ public class mapAwarenessAI { public boolean playerHasManyLightTanksButNoHeavyTank; public boolean playerHasMostlyHeavyAndStealthTanks; public boolean canRushPlayer; + public boolean playerIsFastExpanding; public solidObject[] mapAsset; public boolean[] visionMap; @@ -487,13 +489,36 @@ public class mapAwarenessAI { float z2 = playerNaturalLocation.z; if(Math.sqrt((x1-x2)*(x1-x2) + (z1-z2)*(z1-z2)) < 3.5f) { - canRushPlayer = true; + playerIsFastExpanding = true; break; } } } + + harvester[] harvesters = mainThread.theAssetManager.harvesters; + for(int i = 0; i < harvesters.length; i++) { + if(harvesters[i] != null && harvesters[i].currentHP > 0) { + float x1 = harvesters[i].centre.x; + float z1 = harvesters[i].centre.z; + float x2 = playerNaturalLocation.x; + float z2 = playerNaturalLocation.z; + + if(Math.sqrt((x1-x2)*(x1-x2) + (z1-z2)*(z1-z2)) < 3.5f) { + playerIsFastExpanding = true; + break; + } + } + + + } + } + if(playerIsFastExpanding) { + canRushPlayer = true; + } + + findTheMostVulnerablePlayerBase(); diff --git a/enemyAI/scoutingManagerAI.java b/enemyAI/scoutingManagerAI.java index e506855..c46897c 100644 --- a/enemyAI/scoutingManagerAI.java +++ b/enemyAI/scoutingManagerAI.java @@ -165,20 +165,34 @@ public class scoutingManagerAI { } } - + + if(scout.type == 0) { + + + + if(mainThread.ec.theDefenseManagerAI.minorThreatLocation.x != 0 || mainThread.ec.theDefenseManagerAI.majorThreatLocation.x != 0 || (!mainThread.ec.theMapAwarenessAI.canRushPlayer && gameTime > 240)) { if(scout.currentHP > 0) { - if(gameTime > 315) + if(gameTime > 310) mainThread.ec.theUnitProductionAI.addLightTank((lightTank)scout); scout.moveTo(mainThread.ec.theUnitProductionAI.rallyPoint.x, mainThread.ec.theUnitProductionAI.rallyPoint.z); scout.currentCommand = solidObject.attackMove; scout.secondaryCommand = solidObject.attackMove; + scout = null; } + }else if(mainThread.ec.theMapAwarenessAI.canRushPlayer && gameTime > 290) { + mainThread.ec.theUnitProductionAI.addLightTank((lightTank)scout); + + scout.moveTo(mainThread.ec.theUnitProductionAI.rallyPoint.x, mainThread.ec.theUnitProductionAI.rallyPoint.z); + scout.currentCommand = solidObject.attackMove; + scout.secondaryCommand = solidObject.attackMove; + scout = null; } + return; } diff --git a/enemyAI/unitProductionAI.java b/enemyAI/unitProductionAI.java index 1c9f787..0c287fb 100644 --- a/enemyAI/unitProductionAI.java +++ b/enemyAI/unitProductionAI.java @@ -120,9 +120,9 @@ public class unitProductionAI { //If the difficulty is set to normal or hard, set the rally point just outside of player's natural expansion. //So if the player is going for a fast expansion and don't have much units, the AI can perform a rush attack. - //if((frameAI < 240 || (mainThread.ec.theMapAwarenessAI.canRushPlayer && frameAI < 360)) && mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(1f)) { - // rallyPoint.set(rushRallyPointX, 0, rushRallyPointZ); - //} + if(mainThread.ec.theMapAwarenessAI.canRushPlayer && frameAI < 360 && mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(1f)) { + rallyPoint.set(rushRallyPointX, 0, rushRallyPointZ); + } //make sure not to over produce when the resource is running low int maxNumOfUnitCanBeProduced = theBaseInfo.currentCredit / 500 + 1;