home
This commit is contained in:
parent
e76ebc0d9f
commit
aaea80997a
@ -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;
|
||||
|
@ -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,12 +489,35 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -167,18 +167,32 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user