h
This commit is contained in:
parent
21330e2271
commit
473c363586
@ -18,6 +18,7 @@ public class buildingManagerAI {
|
||||
public int placementTile;
|
||||
public boolean powerPlantUnderConstruction;
|
||||
public int frameAI;
|
||||
public vector tempVector;
|
||||
|
||||
|
||||
public buildingManagerAI (){
|
||||
@ -51,6 +52,8 @@ public class buildingManagerAI {
|
||||
buildingPlacementCheckTiles_3x3[temp] = buildingPlacementCheckTiles_3x3[temp1];
|
||||
buildingPlacementCheckTiles_3x3[temp1] = list;
|
||||
}
|
||||
|
||||
tempVector = new vector(0,0,0);
|
||||
}
|
||||
|
||||
public void addBuildingToQueue(int buildingType){
|
||||
@ -308,7 +311,7 @@ public class buildingManagerAI {
|
||||
float zPos = mainThread.ec.theDefenseManagerAI.missileTurretDeployLocation.z;
|
||||
int centerTile = (int)(xPos*64)/16 + (127 - (int)(zPos*64)/16)*128;
|
||||
if(xPos != 0) {
|
||||
if(hasRoomForPlacement(200, centerTile)) {
|
||||
if(hasRoomForPlacement(199, centerTile)) {
|
||||
int y = 127 - placementTile/128;
|
||||
int x = placementTile%128;
|
||||
missileTurret o = new missileTurret(x*0.25f + 0.125f, -0.65f, y*0.25f + 0.125f, 1);
|
||||
@ -326,46 +329,92 @@ public class buildingManagerAI {
|
||||
public boolean hasRoomForPlacement(int buildingType, int centerTile){
|
||||
//check placement for turrets
|
||||
if(buildingType == 199 || buildingType == 200) {
|
||||
placementTile = -1;
|
||||
|
||||
if(checkIfBlockIsFree(centerTile)) {
|
||||
placementTile = centerTile;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile + 1)) {
|
||||
placementTile = centerTile + 1;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile - 1)) {
|
||||
placementTile = centerTile - 1;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile + 128)) {
|
||||
placementTile = centerTile + 128;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile - 128)) {
|
||||
placementTile = centerTile - 128;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile - 129)) {
|
||||
placementTile = centerTile - 129;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile - 127)) {
|
||||
placementTile = centerTile - 127;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile + 127)) {
|
||||
placementTile = centerTile + 127;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile + 129)) {
|
||||
placementTile = centerTile + 129;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile + 2)) {
|
||||
placementTile = centerTile + 2;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile - 2)) {
|
||||
placementTile = centerTile - 2;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile + 256)) {
|
||||
placementTile = centerTile + 256;
|
||||
return true;
|
||||
}else if(checkIfBlockIsFree(centerTile - 256)) {
|
||||
placementTile = centerTile - 256;
|
||||
}
|
||||
|
||||
|
||||
if(placementTile == -1)
|
||||
return false;
|
||||
|
||||
if(buildingType == 200) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//place missile turret behind buildings to take advantage of its long range and shoot over building ability
|
||||
float x = mainThread.ec.theDefenseManagerAI.majorThreatLocation.x;
|
||||
float z = mainThread.ec.theDefenseManagerAI.majorThreatLocation.z;
|
||||
|
||||
if(x == 0 && z == 0 || !mainThread.ec.theMapAwarenessAI.playerForceNearBase) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int perfectPlacementTile = -1;
|
||||
|
||||
if(checkIfBlockIsFree(centerTile) && !hasLineOfSight(centerTile, x, z)) {
|
||||
perfectPlacementTile = centerTile;
|
||||
}else if(checkIfBlockIsFree(centerTile + 1) && !hasLineOfSight(centerTile + 1, x, z)) {
|
||||
perfectPlacementTile = centerTile + 1;
|
||||
}else if(checkIfBlockIsFree(centerTile - 1) && !hasLineOfSight(centerTile -1, x, z)) {
|
||||
perfectPlacementTile = centerTile - 1;
|
||||
}else if(checkIfBlockIsFree(centerTile + 128) && !hasLineOfSight(centerTile + 128, x, z)) {
|
||||
perfectPlacementTile = centerTile + 128;
|
||||
}else if(checkIfBlockIsFree(centerTile - 128) && !hasLineOfSight(centerTile - 128, x, z)) {
|
||||
perfectPlacementTile = centerTile - 128;
|
||||
}else if(checkIfBlockIsFree(centerTile - 129) && !hasLineOfSight(centerTile - 129, x, z)) {
|
||||
perfectPlacementTile = centerTile - 129;
|
||||
}else if(checkIfBlockIsFree(centerTile - 127) && !hasLineOfSight(centerTile-127, x, z)) {
|
||||
perfectPlacementTile = centerTile - 127;
|
||||
}else if(checkIfBlockIsFree(centerTile + 127) && !hasLineOfSight(centerTile+127, x, z)) {
|
||||
perfectPlacementTile = centerTile + 127;
|
||||
}else if(checkIfBlockIsFree(centerTile + 129) && !hasLineOfSight(centerTile + 129, x, z)) {
|
||||
perfectPlacementTile = centerTile + 129;
|
||||
}else if(checkIfBlockIsFree(centerTile + 2) && !hasLineOfSight(centerTile + 2, x, z)) {
|
||||
perfectPlacementTile = centerTile + 2;
|
||||
}else if(checkIfBlockIsFree(centerTile - 2) && !hasLineOfSight(centerTile - 2, x, z)) {
|
||||
perfectPlacementTile = centerTile - 2;
|
||||
}else if(checkIfBlockIsFree(centerTile + 256) && !hasLineOfSight(centerTile+ 256, x, z)) {
|
||||
perfectPlacementTile = centerTile + 256;
|
||||
}else if(checkIfBlockIsFree(centerTile - 256) && !hasLineOfSight(centerTile - 256, x, z)) {
|
||||
perfectPlacementTile = centerTile - 256;
|
||||
}
|
||||
|
||||
if(perfectPlacementTile != -1) {
|
||||
placementTile = perfectPlacementTile;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -694,5 +743,36 @@ public class buildingManagerAI {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean hasLineOfSight(int tileIndex, float x1, float z1){
|
||||
float z2 = 0.25f*(127 - tileIndex/128);
|
||||
float x2 = 0.25f*(tileIndex%128);
|
||||
|
||||
boolean hasLineOfSight = true;
|
||||
|
||||
float dx = (x1 - x2);
|
||||
float dy = (z1 - z2);
|
||||
|
||||
tempVector.set(dx,0,dy);
|
||||
tempVector.unit();
|
||||
tempVector.scale(0.2f);
|
||||
|
||||
float xStart = x2;
|
||||
float yStart = z2;
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
xStart+=tempVector.x;
|
||||
yStart+=tempVector.z;
|
||||
solidObject s = mainThread.gridMap.tiles[(int)(xStart*4) + (127 - (int)(yStart*4))*128][0];
|
||||
if(s != null){
|
||||
if(s.type > 100 && s.type < 200){
|
||||
hasLineOfSight = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hasLineOfSight;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public class combatManagerAI {
|
||||
for(int i = 0; i < playerUnitInMinimap.length; i++) {
|
||||
if(playerUnitInMinimap[i] != null && playerUnitInMinimap[i].currentHP > 0) {
|
||||
double d = Math.sqrt((combatCenterX - playerUnitInMinimap[i].centre.x)*(combatCenterX - playerUnitInMinimap[i].centre.x) + (combatCenterZ - playerUnitInMinimap[i].centre.z)*(combatCenterZ - playerUnitInMinimap[i].centre.z));
|
||||
if(d < 5){
|
||||
if(d < 7){
|
||||
currentState = aggressing;
|
||||
attackDirection.set(playerUnitInMinimap[i].centre.x - combatCenterX, 0, playerUnitInMinimap[i].centre.z - combatCenterZ);
|
||||
attackDirection.unit();
|
||||
@ -263,7 +263,7 @@ public class combatManagerAI {
|
||||
for(int i = 0; i < playerStructures.length; i++) {
|
||||
if(playerStructures[i] != null && playerStructures[i].currentHP > 0) {
|
||||
double d = Math.sqrt((combatCenterX - playerStructures[i].centre.x)*(combatCenterX - playerStructures[i].centre.x) + (combatCenterZ - playerStructures[i].centre.z)*(combatCenterZ - playerStructures[i].centre.z));
|
||||
if(d < 5){
|
||||
if(d < 7){
|
||||
currentState = aggressing;
|
||||
attackDirection.set(playerStructures[i].centre.x - combatCenterX, 0, playerStructures[i].centre.z - combatCenterZ);
|
||||
attackDirection.unit();
|
||||
@ -302,7 +302,7 @@ public class combatManagerAI {
|
||||
float zPos = mainThread.ec.theDefenseManagerAI.majorThreatLocation.z;
|
||||
float d1 = (attackPosition.x - combatCenterX)*(attackPosition.x - combatCenterX) + (attackPosition.z - combatCenterZ)*(attackPosition.z - combatCenterZ);
|
||||
float d2 = (xPos - combatCenterX)*(xPos - combatCenterX) + (zPos - combatCenterZ)*(zPos - combatCenterZ);
|
||||
if(d2 <= d1) {
|
||||
if(d2 -2 <= d1) {
|
||||
attackPosition.set(xPos, 0, zPos);
|
||||
}
|
||||
dealWithMajorThreat = true;
|
||||
@ -374,7 +374,7 @@ public class combatManagerAI {
|
||||
|
||||
//check if the player force has become stronger than the AI during the marching towards attack position
|
||||
//System.out.println("distanceToTarget: " + distanceToTarget);
|
||||
if(checkIfAIHasBiggerForce(1.5f) == false && distanceToTarget > 8){
|
||||
if(checkIfAIHasBiggerForce(1.5f) == false && distanceToTarget > 8 && !(mainThread.ec.theMapAwarenessAI.playerForceNearBase && dealWithMajorThreat)){
|
||||
playerHasBecomeStrongerThanAIDuringMarching = true;
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ public class combatManagerAI {
|
||||
staticDefenseAhead = false;
|
||||
double distanceToTower = 999;
|
||||
for(int i = 0; i < mainThread.ec.theMapAwarenessAI.playerStaticDefenseLocations.length; i++) {
|
||||
if(mainThread.ec.theMapAwarenessAI.playerStaticDefenseSize[i] > 6) {
|
||||
if(mainThread.ec.theMapAwarenessAI.playerStaticDefenseSize[i] > 0) {
|
||||
|
||||
float xPos = mainThread.ec.theMapAwarenessAI.playerStaticDefenseLocations[i].x;
|
||||
float zPos = mainThread.ec.theMapAwarenessAI.playerStaticDefenseLocations[i].z;
|
||||
|
@ -81,7 +81,7 @@ public class defenseManagerAI {
|
||||
lightTanksControlledByCombatAI = mainThread.ec.theUnitProductionAI.lightTanksControlledByCombatAI;
|
||||
|
||||
//after 500 seconds mark, borrow 2 stealth tanks from combat manager, and send them to guard western and southern side of the main base
|
||||
if(frameAI >= 630 && mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(0.8f)) {
|
||||
if(frameAI >= 450 && mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(0.8f)) {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
if(observers[i] == null || observers[i].currentHP <=0) {
|
||||
for(int j = 0; j < stealthTanksControlledByCombatAI.length; j++) {
|
||||
@ -97,7 +97,7 @@ public class defenseManagerAI {
|
||||
}
|
||||
|
||||
|
||||
if(frameAI > 980) {
|
||||
if(frameAI > 1000) {
|
||||
xPos = 0.25f;
|
||||
zPos = 20.5f;
|
||||
|
||||
@ -151,10 +151,10 @@ public class defenseManagerAI {
|
||||
|
||||
if(frameAI%20 < 10) {
|
||||
xPos = 30f;
|
||||
zPos = 20f;
|
||||
zPos = 15f;
|
||||
}else {
|
||||
xPos = 26f;
|
||||
zPos = 20f;
|
||||
zPos = 15f;
|
||||
}
|
||||
|
||||
if(frameAI > 1000) {
|
||||
@ -229,6 +229,36 @@ public class defenseManagerAI {
|
||||
|
||||
}
|
||||
|
||||
//treat player buildings that is close to the base as major threat too.
|
||||
constructionYard[] constructionYards = mainThread.theAssetManager.constructionYards;
|
||||
boolean playerBuildingNearBase = false;
|
||||
solidObject[] playerStructures = mainThread.ec.theMapAwarenessAI.playerStructures;
|
||||
for(int i = 0; i < playerStructures.length; i++) {
|
||||
if(playerStructures[i] != null && playerStructures[i].currentHP > 0) {
|
||||
float x1 = playerStructures[i].centre.x;
|
||||
float z1 = playerStructures[i].centre.z;
|
||||
for(int j = 0; j < constructionYards.length; j++) {
|
||||
if(constructionYards[j] != null && constructionYards[i].teamNo != 0 && constructionYards[j].currentHP > 0) {
|
||||
float x2 = constructionYards[j].centre.x;
|
||||
float z2 = constructionYards[j].centre.z;
|
||||
double d = Math.sqrt((x1-x2)*(x1-x2) + (z1-z2)*(z1-z2));
|
||||
|
||||
if(d < 4) {
|
||||
playerBuildingNearBase = true;
|
||||
majorThreatCooldown = 20;
|
||||
majorThreatLocation.set(playerStructures[i].centre);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(playerBuildingNearBase) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -272,7 +302,7 @@ public class defenseManagerAI {
|
||||
}
|
||||
|
||||
|
||||
constructionYard[] constructionYards = mainThread.theAssetManager.constructionYards;
|
||||
|
||||
int numOfConstructionYard = 0;
|
||||
|
||||
for(int i = 0; i < constructionYards.length; i++){
|
||||
@ -323,7 +353,7 @@ public class defenseManagerAI {
|
||||
needGunTurret = true;
|
||||
}
|
||||
|
||||
if(!missileTurretAlreadyInQueue && majorThreatLocation.x != 0 && mainPlayerForceSize !=0) {
|
||||
if(!missileTurretAlreadyInQueue && majorThreatLocation.x != 0 && (mainPlayerForceSize !=0 || playerBuildingNearBase)) {
|
||||
needMissileTurret = true;
|
||||
}
|
||||
|
||||
@ -331,6 +361,7 @@ public class defenseManagerAI {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//check if AI needs to deploy static defense
|
||||
/*
|
||||
Deploy gun turret if the minor/major threat is close enough to the construction yard
|
||||
@ -399,14 +430,15 @@ public class defenseManagerAI {
|
||||
threatZ = majorThreatLocation.z;
|
||||
}
|
||||
|
||||
|
||||
//find deploy location of gun turret
|
||||
if(threatX != 0 && distanceToThreat < 4.75 && numOfGunTurretNearThreat < (float)mainPlayerForceSize/3) {
|
||||
if(threatX != 0 && distanceToThreat < 4.75 && (numOfGunTurretNearThreat < (float)mainPlayerForceSize/3 || playerBuildingNearBase)) {
|
||||
|
||||
float d = 1.85f; //minimum deploy distance from conyard
|
||||
if(distanceToThreat > d + gunTurret.attackRange)
|
||||
d = distanceToThreat - gunTurret.attackRange;
|
||||
if(distanceToThreat < 1.8)
|
||||
d = 1.25f;
|
||||
if(distanceToThreat < 3.5)
|
||||
d = 1.75f;
|
||||
|
||||
gunTurretDeployLocation.x = constructionYards[i].centre.x + (threatX - constructionYards[i].centre.x)/distanceToThreat*d;
|
||||
gunTurretDeployLocation.z = constructionYards[i].centre.z + (threatZ - constructionYards[i].centre.z)/distanceToThreat*d;
|
||||
@ -415,13 +447,13 @@ public class defenseManagerAI {
|
||||
}
|
||||
|
||||
//find deploy location of missile turret
|
||||
if(threatX != 0 && distanceToThreat < 5.15 && (numOfMissileTurretNearThreat < mainPlayerForceSize/6 )) {
|
||||
if(threatX != 0 && distanceToThreat < 5.15 && (numOfMissileTurretNearThreat < mainPlayerForceSize/6 || (playerBuildingNearBase && numOfMissileTurretNearThreat < 2))) {
|
||||
|
||||
float d = 1.65f; //minimum deploy distance from conyard
|
||||
if(distanceToThreat > d + missileTurret.attackRange)
|
||||
d = distanceToThreat - missileTurret.attackRange;
|
||||
if(distanceToThreat < 2.2)
|
||||
d = 1f;
|
||||
if(distanceToThreat < 4.75)
|
||||
d = 1.25f;
|
||||
|
||||
missileTurretDeployLocation.x = constructionYards[i].centre.x + (threatX - constructionYards[i].centre.x)/distanceToThreat*d;
|
||||
missileTurretDeployLocation.z = constructionYards[i].centre.z + (threatZ - constructionYards[i].centre.z)/distanceToThreat*d;
|
||||
|
@ -26,8 +26,10 @@ public class harassmentAI {
|
||||
miniFrameAI++;
|
||||
frameAI = mainThread.ec.frameAI;
|
||||
|
||||
//if(miniFrameAI%30 == 29)
|
||||
// System.out.println(frameAI + " " + mainThread.ec.theCombatManagerAI.rushAttackTime + " " + mainThread.ec.theMapAwarenessAI.targetPlayerExpension);
|
||||
if(miniFrameAI%30 == 29) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package enemyAI;
|
||||
import core.AssetManager;
|
||||
import core.baseInfo;
|
||||
import core.mainThread;
|
||||
import entity.constructionYard;
|
||||
import entity.goldMine;
|
||||
import entity.harvester;
|
||||
import entity.solidObject;
|
||||
@ -47,11 +48,14 @@ public class mapAwarenessAI {
|
||||
public boolean playIsRushingHighTierUnits;
|
||||
public boolean playerLikelyCanNotProduceHighTierUnits;
|
||||
public boolean playerDoesntHaveMassHeavyTanks;
|
||||
public boolean playerArmyCanBeCounteredWithLightTanks;
|
||||
public boolean playerIsRushingLightTank;
|
||||
public boolean playerHasManyLightTanksButNoHeavyTank;
|
||||
public boolean playerHasMostlyHeavyAndStealthTanks;
|
||||
public boolean playerHasMostlyLightAndStealthTanks;
|
||||
public boolean canRushPlayer;
|
||||
public boolean playerIsFastExpanding;
|
||||
public boolean playerForceNearBase;
|
||||
|
||||
public solidObject[] mapAsset;
|
||||
public boolean[] visionMap;
|
||||
@ -449,7 +453,7 @@ public class mapAwarenessAI {
|
||||
float lightTankRatio = (float)(numberOfLightTanks_player)/(totalNumberOfPlayerUnits + 1);
|
||||
|
||||
playerHasMostlyLightTanks = (numberOfLightTanks_player > 5 && lightTankRatio > 0.8f) || (frameAI < 420 && numberOfLightTanks_player > 1 && lightTankRatio >= 0.75f);
|
||||
playerHasMostlyHeavyTanks = numberOfHeavyTanks_player > 1 && (float)(numberOfHeavyTanks_player)/(totalNumberOfPlayerUnits) > 0.6f;
|
||||
playerHasMostlyHeavyTanks = numberOfHeavyTanks_player > 1 && (float)(numberOfHeavyTanks_player)/(totalNumberOfPlayerUnits) > 0.8f;
|
||||
playerHasManyLightTanksButNoHeavyTank = lightTankRatio > 0.5 && numberOfHeavyTanks_player < 3;
|
||||
|
||||
playIsRushingHighTierUnits = mainThread.gameFrame/30 > 250 && mainThread.gameFrame/30 < 400
|
||||
@ -463,8 +467,15 @@ public class mapAwarenessAI {
|
||||
|
||||
playerIsRushingLightTank = mainThread.gameFrame/30 > 300 && mainThread.gameFrame/30 < 600 && ((playerLikelyCanNotProduceHighTierUnits && numberOfStealthTanks_player < 3) || playerHasMostlyLightTanks);
|
||||
|
||||
playerHasMostlyHeavyAndStealthTanks = (maxNumberOfStealthTanks_playerInLastFiveMinutes >=3 ) && (float)(numberOfHeavyTanks_player + numberOfStealthTanks_player)/totalNumberOfPlayerUnits > 0.8f;
|
||||
playerHasMostlyHeavyAndStealthTanks = (maxNumberOfStealthTanks_playerInLastFiveMinutes >=3 ) && (float)(numberOfHeavyTanks_player + numberOfStealthTanks_player)/totalNumberOfPlayerUnits > 0.85f;
|
||||
|
||||
playerHasMostlyLightAndStealthTanks = numberOfLightTanks_player > 5 && maxNumberOfStealthTanks_playerInLastFiveMinutes >=3 && (float)(numberOfLightTanks_player + numberOfStealthTanks_player)/totalNumberOfPlayerUnits > 0.85f;
|
||||
|
||||
if(frameAI < 600)
|
||||
playerArmyCanBeCounteredWithLightTanks = false;
|
||||
else {
|
||||
playerArmyCanBeCounteredWithLightTanks = maxNumberOfStealthTanks_playerInLastFiveMinutes < 6 && maxNumberOfStealthTanks_playerInLastFiveMinutes/(totalNumberOfPlayerUnits + 1) < 0.2f;
|
||||
}
|
||||
|
||||
//advanced counting of player units
|
||||
if(numberOfStealthTanks_player > maxNumberOfStealthTanks_playerInLastFiveMinutes) {
|
||||
@ -520,9 +531,6 @@ public class mapAwarenessAI {
|
||||
canRushPlayer = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
findTheMostVulnerablePlayerBase();
|
||||
|
||||
findPlayerForceLocation();
|
||||
@ -753,6 +761,22 @@ public class mapAwarenessAI {
|
||||
}
|
||||
|
||||
mainPlayerForceDirection.unit();
|
||||
|
||||
//check if player force is near any of AI's base
|
||||
playerForceNearBase = false;
|
||||
float x = mainPlayerForceLocation.x;
|
||||
float z = mainPlayerForceLocation.z;
|
||||
constructionYard[] constructionYards = mainThread.theAssetManager.constructionYards;
|
||||
for(int i = 0; i < constructionYards.length; i++) {
|
||||
if(constructionYards[i] != null && constructionYards[i].teamNo != 0 && constructionYards[i].currentHP > 0) {
|
||||
double d = Math.sqrt((constructionYards[i].centre.x - x)*(constructionYards[i].centre.x - x) + (constructionYards[i].centre.z - z)*(constructionYards[i].centre.z - z));
|
||||
if(d < 4.75) {
|
||||
playerForceNearBase = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class unitProductionAI {
|
||||
}
|
||||
if(z != 999999) {
|
||||
|
||||
rallyPoint.set(x - 2.25f, 0, z - 1.75f);
|
||||
rallyPoint.set(x - 2f, 0, z - 1.5f);
|
||||
|
||||
if(frameAI < 240) {
|
||||
rallyPoint.set(mainThread.theAssetManager.goldMines[5].centre);
|
||||
@ -163,35 +163,36 @@ public class unitProductionAI {
|
||||
boolean playerDoesntHaveMassHeavyTanks = mainThread.ec.theMapAwarenessAI.playerDoesntHaveMassHeavyTanks;
|
||||
boolean playerHasManyLightTanksButNoHeavyTank = mainThread.ec.theMapAwarenessAI.playerHasManyLightTanksButNoHeavyTank;
|
||||
boolean playerHasMostlyHeavyAndStealthTanks = mainThread.ec.theMapAwarenessAI.playerHasMostlyHeavyAndStealthTanks;
|
||||
|
||||
boolean playerHasMostlyLightAndStealthTanks = mainThread.ec.theMapAwarenessAI.playerHasMostlyLightAndStealthTanks;
|
||||
boolean playerArmyCanBeCounteredWithLightTanks = mainThread.ec.theMapAwarenessAI.playerArmyCanBeCounteredWithLightTanks;
|
||||
|
||||
int timeToBuildHeavyTank = 400;
|
||||
int timeToBuildStealthTank = 200;
|
||||
if(mainThread.ec.theMapAwarenessAI.canRushPlayer) {
|
||||
//when AI decides to rush the player, then dont build higher tier units so it can mass produce light tanks
|
||||
timeToBuildHeavyTank = 500;
|
||||
timeToBuildStealthTank = 500;
|
||||
timeToBuildStealthTank = 300;
|
||||
}
|
||||
|
||||
boolean b1 = (numberOfRocketTanks_AI < 3 && !playerHasMostlyHeavyTanks && (frameAI > 400 || frameAI > 170 && frameAI < 240 && mainThread.ec.theMapAwarenessAI.numberOfConstructionYard_player > 0) && !playerHasMostlyLightTanks);
|
||||
boolean b2 = (numberOfRocketTanks_AI < numberOfPlayerGunTurrets + numberOfPlayerMissileTurrets*1.5);
|
||||
if( b1 || b2){
|
||||
currentProductionOrder = produceRocketTank;
|
||||
}else if(theBaseInfo.canBuildHeavyTank && !playerHasMostlyHeavyTanks &&
|
||||
}else if(theBaseInfo.canBuildHeavyTank && !playerHasMostlyHeavyTanks && !playerHasMostlyLightTanks && !playerHasMostlyLightAndStealthTanks && !playerArmyCanBeCounteredWithLightTanks &&
|
||||
(playerHasMostlyHeavyAndStealthTanks || (frameAI > timeToBuildHeavyTank && numberOfHeavyTanks_AI < 3) ||
|
||||
!playerHasManyLightTanksButNoHeavyTank
|
||||
&& !playerHasMostlyLightTanks
|
||||
&& !(numberOfHeavyTanks_player == 0 && maxNumberOfStealthTanks_playerInLastFiveMinutes < 3 && frameAI > 600)
|
||||
&& !(playerHasMostlyHeavyTanks && numberOfStealthTanks_player < numberOfHeavyTanks_AI*2)
|
||||
&& (playIsRushingHighTierUnits || maxNumberOfStealthTanks_playerInLastFiveMinutes*4 > numberOfHeavyTanks_AI))){
|
||||
currentProductionOrder = produceHeavyTank;
|
||||
}else if(theBaseInfo.canBuildStealthTank && !playerHasMostlyHeavyTanks && !(numberOfStealthTanksControlledByCombatAI >= 8 && frameAI < 600) && !(numberOfStealthTanksControlledByCombatAI >= 16 && frameAI > 600)
|
||||
&& (playerHasMostlyLightTanks || playerLikelyCanNotProduceHighTierUnits || playerDoesntHaveMassHeavyTanks) && !playerHasMostlyHeavyTanks && (frameAI > timeToBuildStealthTank || numberOfLightTanks_player > 8)){
|
||||
}else if(theBaseInfo.canBuildStealthTank && playerDoesntHaveMassHeavyTanks && !playerHasMostlyHeavyTanks && !playerArmyCanBeCounteredWithLightTanks && !(numberOfStealthTanksControlledByCombatAI >= 8 && frameAI < 600) && !(numberOfStealthTanksControlledByCombatAI >= 16 && frameAI > 600)
|
||||
&& (playerHasMostlyLightTanks || playerLikelyCanNotProduceHighTierUnits || playerDoesntHaveMassHeavyTanks || playerHasMostlyLightAndStealthTanks) && !playerHasMostlyHeavyTanks && (frameAI > timeToBuildStealthTank || numberOfLightTanks_player > 8)){
|
||||
currentProductionOrder = produceStealthTank;
|
||||
}else{
|
||||
currentProductionOrder = produceLightTank;
|
||||
}
|
||||
|
||||
|
||||
//make decision on what tech to research
|
||||
if(mainThread.ec.theBuildingManagerAI.theBaseInfo.numberOfCommunicationCenter > 0) {
|
||||
if(mainThread.ec.theDefenseManagerAI.needMissileTurret || theBaseInfo.currentCredit > 1500 && frameAI > 450) {
|
||||
|
@ -381,7 +381,7 @@ public class heavyTank extends solidObject{
|
||||
}
|
||||
}
|
||||
|
||||
if(canSelfRepair && currentHP < maxHP && mainThread.gameFrame%6==0){
|
||||
if(canSelfRepair && currentHP < maxHP && mainThread.gameFrame%5==0){
|
||||
currentHP++;
|
||||
}
|
||||
|
||||
|
@ -976,7 +976,7 @@ public class lightTank extends solidObject{
|
||||
if(targetObject.type == 0)
|
||||
theDamage*=1.2;
|
||||
if(targetObject.type >= 100)
|
||||
theDamage*=0.8;
|
||||
theDamage*=0.6;
|
||||
|
||||
theAssetManager.spawnBullet(attackAngle, theDamage, targetObject, firingPosition, this);
|
||||
attackCoolDown = myAttackCooldown;
|
||||
|
Loading…
x
Reference in New Issue
Block a user