h
This commit is contained in:
parent
ba28e46f2f
commit
08f3717542
@ -162,6 +162,10 @@ public class baseExpensionAI {
|
||||
}
|
||||
}
|
||||
|
||||
if(mainThread.ec.difficulty == 1)
|
||||
lowGoldmineThreshold = 22500;
|
||||
else if(mainThread.ec.difficulty == 0)
|
||||
lowGoldmineThreshold = 15000;
|
||||
|
||||
if(myMCV == null && expensionGoldMine.goldDeposite >= 17500 && (mainThread.ec.theEconomyManagerAI.preferedGoldMine.goldDeposite < lowGoldmineThreshold ||
|
||||
(!hasRefineryNearTheGoldmine(mainThread.ec.theEconomyManagerAI.preferedGoldMine) && !hasConstructionYardNearGoldMine(mainThread.ec.theEconomyManagerAI.preferedGoldMine)) ||
|
||||
@ -428,6 +432,9 @@ public class baseExpensionAI {
|
||||
|
||||
//3 stealth tanks will make a perfect scout team for the base expansion exploration
|
||||
public boolean needStealthTank(){
|
||||
if(mainThread.ec.difficulty == 0)
|
||||
return false;
|
||||
|
||||
for(int i = 0; i < scouts.length; i++){
|
||||
if((scouts[i] == null || scouts[i].currentHP <=0) && frameAI > 800){
|
||||
return true;
|
||||
|
@ -173,7 +173,7 @@ public class buildingManagerAI {
|
||||
|
||||
|
||||
//build more factory if we have plenty of money in the bank
|
||||
if(theBaseInfo.currentCredit > 2200 && theBaseInfo.canBuildFactory && theBaseInfo.numberOfFactory < 5 && theBaseInfo.numberOfFactory <= mainThread.ec.theEconomyManagerAI.numberOfharvesters/2){
|
||||
if(theBaseInfo.currentCredit > 2200 && mainThread.ec.difficulty > 0 && theBaseInfo.canBuildFactory && theBaseInfo.numberOfFactory < 5 && theBaseInfo.numberOfFactory <= mainThread.ec.theEconomyManagerAI.numberOfharvesters/2){
|
||||
addBuildingToQueue(105);
|
||||
}
|
||||
|
||||
|
@ -129,15 +129,6 @@ public class combatManagerAI {
|
||||
combatCenterX = mainThread.ec.theUnitProductionAI.combatAICenterX;
|
||||
combatCenterZ = mainThread.ec.theUnitProductionAI.combatAICenterZ;
|
||||
|
||||
|
||||
//System.out.println(combatCenterX + " " + combatCenterZ + " " + currentState + " " + numberOfUnitInCombatRadius);
|
||||
|
||||
|
||||
if(Float.isNaN(combatCenterX) || Float.isNaN(combatCenterZ)) {
|
||||
// combatCenterX = 0;
|
||||
// combatCenterZ= 0;
|
||||
}
|
||||
|
||||
|
||||
boolean frontalTroopIverwhelmed = false;
|
||||
boolean shouldAttack = false;
|
||||
@ -161,7 +152,7 @@ public class combatManagerAI {
|
||||
if(currentState == booming){
|
||||
//enemy AI compares its own force with player's force, then make a decision whether it should attack or not
|
||||
attackTime = standardAttackTime;
|
||||
if(mainThread.ec.theMapAwarenessAI.canRushPlayer)
|
||||
if(mainThread.ec.theMapAwarenessAI.canRushPlayer && mainThread.ec.difficulty > 0)
|
||||
attackTime = rushAttackTime;
|
||||
|
||||
int targetPlayerExpension = mainThread.ec.theMapAwarenessAI.targetPlayerExpension;
|
||||
@ -403,8 +394,12 @@ public class combatManagerAI {
|
||||
}
|
||||
}
|
||||
|
||||
if(mainThread.ec.difficulty < 1)
|
||||
staticDefenseAhead = false;
|
||||
|
||||
|
||||
//if a rush tactics is denied by the player (e.g player builds static defenses around natural), then briefly suspend the attacking force (wait for rocket tanks to take out the static defenses)
|
||||
if(frameAI < standardAttackTime && mainThread.ec.theMapAwarenessAI.canRushPlayer && distanceToTower < 2){
|
||||
if(frameAI < standardAttackTime && mainThread.ec.theMapAwarenessAI.canRushPlayer && distanceToTower < 2 && mainThread.ec.difficulty > 0){
|
||||
if(Math.abs(attackPosition.x - myRallyPointX) > 12 || Math.abs(attackPosition.z - myRallyPointZ) > 12) {
|
||||
for(int i = 0; i < troopsControlledByCombatAI.length; i++) {
|
||||
if(troopsControlledByCombatAI[i] != null && troopsControlledByCombatAI[i].currentHP > 0 && troopsControlledByCombatAI[i].type != 1) {
|
||||
@ -625,47 +620,54 @@ public class combatManagerAI {
|
||||
|
||||
for(int i = 0; i < mainThread.ec.theUnitProductionAI.numberOfCombatUnit; i++){
|
||||
if(team[i] != null && team[i].currentHP > 0){
|
||||
//stop chasing player unit if it has got out of sight
|
||||
if(team[i].targetObject != null && team[i].targetObject.currentHP >0) {
|
||||
int targetPositionIndex = (int)(team[i].targetObject.centre.x*64)/16 + (127 - (int)(team[i].targetObject.centre.z*64)/16)*128;
|
||||
|
||||
if(team[i].attackStatus != solidObject.isAttacking && team[i].underAttackCountDown == 0 && (!mainThread.ec.visionMap[targetPositionIndex] || team[i].targetObject.isCloaked))
|
||||
team[i].targetObject = null;
|
||||
}
|
||||
|
||||
//marching forward
|
||||
if(team[i].targetObject == null || team[i].targetObject.currentHP <=0){
|
||||
|
||||
|
||||
|
||||
if(staticDefenseAhead) {
|
||||
if(team[i].type == 1) {
|
||||
team[i].attackMoveTo(team[i].centre.x + attackDirection.x*teamRadius, team[i].centre.z + attackDirection.z*teamRadius);
|
||||
}else {
|
||||
team[i].attackMoveTo(combatCenterX, combatCenterZ);
|
||||
}
|
||||
if(mainThread.ec.difficulty > 0) {
|
||||
//stop chasing player unit if it has got out of sight
|
||||
if(team[i].targetObject != null && team[i].targetObject.currentHP >0) {
|
||||
int targetPositionIndex = (int)(team[i].targetObject.centre.x*64)/16 + (127 - (int)(team[i].targetObject.centre.z*64)/16)*128;
|
||||
|
||||
|
||||
}else if(!(team[i].currentMovementStatus == solidObject.hugRight || team[i].currentMovementStatus == solidObject.hugLeft)){
|
||||
|
||||
double d = Math.sqrt((team[i].centre.x - combatCenterX)*(team[i].centre.x - combatCenterX) + (team[i].centre.z - combatCenterZ)*(team[i].centre.z - combatCenterZ))*3;
|
||||
|
||||
if(d > teamRadius){
|
||||
if(staticDefenseNearAttackPosition || !playerForceIsMuchWeakerThanAI || mainThread.ec.theMapAwarenessAI.playerAssetDestoryedCountDown == 0)
|
||||
team[i].attackMoveTo(gatherPoint.x, gatherPoint.z);
|
||||
else
|
||||
team[i].attackMoveTo(attackPosition.x, attackPosition.z);
|
||||
|
||||
}else{
|
||||
team[i].attackMoveTo(team[i].centre.x + attackDirection.x*teamRadius, team[i].centre.z + attackDirection.z*teamRadius);
|
||||
|
||||
}
|
||||
if(team[i].attackStatus != solidObject.isAttacking && team[i].underAttackCountDown == 0 && (!mainThread.ec.visionMap[targetPositionIndex] || team[i].targetObject.isCloaked))
|
||||
team[i].targetObject = null;
|
||||
}
|
||||
|
||||
|
||||
//marching forward
|
||||
if(team[i].targetObject == null || team[i].targetObject.currentHP <=0){
|
||||
|
||||
|
||||
|
||||
if(staticDefenseAhead) {
|
||||
if(team[i].type == 1) {
|
||||
team[i].attackMoveTo(team[i].centre.x + attackDirection.x*teamRadius, team[i].centre.z + attackDirection.z*teamRadius);
|
||||
}else {
|
||||
team[i].attackMoveTo(combatCenterX, combatCenterZ);
|
||||
}
|
||||
|
||||
|
||||
}else if(!(team[i].currentMovementStatus == solidObject.hugRight || team[i].currentMovementStatus == solidObject.hugLeft)){
|
||||
|
||||
double d = Math.sqrt((team[i].centre.x - combatCenterX)*(team[i].centre.x - combatCenterX) + (team[i].centre.z - combatCenterZ)*(team[i].centre.z - combatCenterZ))*3;
|
||||
|
||||
if(d > teamRadius){
|
||||
if(staticDefenseNearAttackPosition || !playerForceIsMuchWeakerThanAI || mainThread.ec.theMapAwarenessAI.playerAssetDestoryedCountDown == 0)
|
||||
team[i].attackMoveTo(gatherPoint.x, gatherPoint.z);
|
||||
else
|
||||
team[i].attackMoveTo(attackPosition.x, attackPosition.z);
|
||||
|
||||
}else{
|
||||
team[i].attackMoveTo(team[i].centre.x + attackDirection.x*teamRadius, team[i].centre.z + attackDirection.z*teamRadius);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
team[i].currentCommand = solidObject.attackMove;
|
||||
team[i].secondaryCommand = solidObject.attackMove;
|
||||
|
||||
}
|
||||
}else {
|
||||
team[i].attackMoveTo(attackPosition.x, attackPosition.z);
|
||||
team[i].currentCommand = solidObject.attackMove;
|
||||
team[i].secondaryCommand = solidObject.attackMove;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -729,6 +731,8 @@ public class combatManagerAI {
|
||||
|
||||
public boolean checkIfAIHasBiggerForce(float ratio){
|
||||
|
||||
|
||||
|
||||
int numberOfLightTanks_AI = mainThread.ec.theUnitProductionAI.numberOfLightTanksControlledByCombatAI;
|
||||
int numberOfRocketTanks_AI = mainThread.ec.theUnitProductionAI.numberOfRocketTanksControlledByCombatAI;
|
||||
int numberOfStealthTanks_AI = mainThread.ec.theUnitProductionAI.numberOfStealthTanksControlledByCombatAI;
|
||||
@ -767,6 +771,8 @@ public class combatManagerAI {
|
||||
|
||||
//System.out.println("unrevealedPlayerForceStrength" + unrevealedPlayerForceStrength + " " + "enemyAIForceStrength " + enemyAIForceStrength + " " + "playerForceStrength" + playerForceStrength);
|
||||
|
||||
|
||||
|
||||
return enemyAIForceStrength > 0 && playerForceStrength/enemyAIForceStrength < ratio;
|
||||
}
|
||||
|
||||
|
@ -80,98 +80,100 @@ 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 >= 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++) {
|
||||
if(stealthTanksControlledByCombatAI[j] != null && stealthTanksControlledByCombatAI[j].currentHP == 80 && stealthTanksControlledByCombatAI[j].attackStatus != solidObject.isAttacking) {
|
||||
observers[i] = stealthTanksControlledByCombatAI[j];
|
||||
stealthTanksControlledByCombatAI[j] = null;
|
||||
float xPos = 20f;
|
||||
float zPos = 30.5f;
|
||||
|
||||
if(i == 1) {
|
||||
xPos = 30f;
|
||||
zPos = 20f;
|
||||
}
|
||||
|
||||
|
||||
if(frameAI > 1000) {
|
||||
xPos = 0.25f;
|
||||
zPos = 20.5f;
|
||||
if(mainThread.ec.difficulty == 2) {
|
||||
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++) {
|
||||
if(stealthTanksControlledByCombatAI[j] != null && stealthTanksControlledByCombatAI[j].currentHP == 80 && stealthTanksControlledByCombatAI[j].attackStatus != solidObject.isAttacking) {
|
||||
observers[i] = stealthTanksControlledByCombatAI[j];
|
||||
stealthTanksControlledByCombatAI[j] = null;
|
||||
float xPos = 20f;
|
||||
float zPos = 30.5f;
|
||||
|
||||
if(i == 1) {
|
||||
xPos = 18.75f;
|
||||
zPos = 5f;
|
||||
xPos = 30f;
|
||||
zPos = 20f;
|
||||
}
|
||||
|
||||
|
||||
if(frameAI > 1000) {
|
||||
xPos = 0.25f;
|
||||
zPos = 20.5f;
|
||||
|
||||
if(i == 1) {
|
||||
xPos = 18.75f;
|
||||
zPos = 5f;
|
||||
}
|
||||
}
|
||||
|
||||
observers[i].moveTo(xPos, zPos);
|
||||
observers[i].currentCommand = solidObject.move;
|
||||
observers[i].secondaryCommand = solidObject.StandBy;
|
||||
break;
|
||||
}
|
||||
|
||||
observers[i].moveTo(xPos, zPos);
|
||||
observers[i].currentCommand = solidObject.move;
|
||||
observers[i].secondaryCommand = solidObject.StandBy;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//keep an eye on player units and avoid being detected
|
||||
for(int i = 0; i < observers.length; i++) {
|
||||
if(observers[i] != null) {
|
||||
|
||||
if(!evadePlayerUnit(i)) {
|
||||
float xPos = 0;
|
||||
float zPos = 0;
|
||||
|
||||
//keep an eye on player units and avoid being detected
|
||||
for(int i = 0; i < observers.length; i++) {
|
||||
if(observers[i] != null) {
|
||||
|
||||
//if there is no player units in sight, return to patrol position
|
||||
if(i == 0) {
|
||||
if(frameAI%28 < 14) {
|
||||
xPos = 15.5f;
|
||||
zPos = 30.5f;
|
||||
}else {
|
||||
xPos = 15.5f;
|
||||
zPos = 24.5f;
|
||||
}
|
||||
if(!evadePlayerUnit(i)) {
|
||||
float xPos = 0;
|
||||
float zPos = 0;
|
||||
|
||||
if(frameAI > 1000) {
|
||||
if(frameAI%18 < 9) {
|
||||
xPos = 0.25f;
|
||||
zPos = 20.5f;
|
||||
//if there is no player units in sight, return to patrol position
|
||||
if(i == 0) {
|
||||
if(frameAI%28 < 14) {
|
||||
xPos = 15.5f;
|
||||
zPos = 30.5f;
|
||||
}else {
|
||||
xPos = 5f;
|
||||
zPos = 20.5f;
|
||||
xPos = 15.5f;
|
||||
zPos = 24.5f;
|
||||
}
|
||||
}
|
||||
|
||||
if(frameAI > 1000) {
|
||||
if(frameAI%18 < 9) {
|
||||
xPos = 0.25f;
|
||||
zPos = 20.5f;
|
||||
}else {
|
||||
xPos = 5f;
|
||||
zPos = 20.5f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(i == 1) {
|
||||
|
||||
if(frameAI%30 < 15) {
|
||||
xPos = 29.25f;
|
||||
zPos = 17f;
|
||||
}else {
|
||||
xPos = 29.25f;
|
||||
zPos = 10f;
|
||||
}
|
||||
|
||||
if(frameAI > 1000) {
|
||||
if(frameAI%14 < 7) {
|
||||
xPos = 18.75f;
|
||||
zPos = 5f;
|
||||
}else {
|
||||
xPos = 18.75f;
|
||||
zPos = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
observers[i].moveTo(xPos, zPos);
|
||||
observers[i].currentCommand = solidObject.move;
|
||||
observers[i].secondaryCommand = solidObject.StandBy;
|
||||
}
|
||||
|
||||
if(i == 1) {
|
||||
|
||||
if(frameAI%30 < 15) {
|
||||
xPos = 29.25f;
|
||||
zPos = 17f;
|
||||
}else {
|
||||
xPos = 29.25f;
|
||||
zPos = 10f;
|
||||
}
|
||||
|
||||
if(frameAI > 1000) {
|
||||
if(frameAI%14 < 7) {
|
||||
xPos = 18.75f;
|
||||
zPos = 5f;
|
||||
}else {
|
||||
xPos = 18.75f;
|
||||
zPos = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
observers[i].moveTo(xPos, zPos);
|
||||
observers[i].currentCommand = solidObject.move;
|
||||
observers[i].secondaryCommand = solidObject.StandBy;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,8 @@ public class enemyCommander {
|
||||
}
|
||||
|
||||
if(mainThread.gameFrame % 30 == 3){
|
||||
theScoutingManagerAI.processAI();
|
||||
if(difficulty > 0)
|
||||
theScoutingManagerAI.processAI();
|
||||
}
|
||||
|
||||
if(mainThread.gameFrame % 30 == 4){
|
||||
@ -121,16 +122,18 @@ public class enemyCommander {
|
||||
}
|
||||
|
||||
if(mainThread.gameFrame % 30 == 7){
|
||||
theDefenseManagerAI.processAI();
|
||||
if(difficulty > 0)
|
||||
theDefenseManagerAI.processAI();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(difficulty == 2){
|
||||
theHarassmentAI.processAI();
|
||||
|
||||
|
||||
//if(mainThread.frameIndex % 5 == 0){
|
||||
theMicroManagementAI.processAI();
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class unitProductionAI {
|
||||
|
||||
rallyPoint.set(x - 2f, 0, z - 1.5f);
|
||||
|
||||
if(frameAI < 240) {
|
||||
if(frameAI < 240 && mainThread.ec.difficulty == 2) {
|
||||
rallyPoint.set(mainThread.theAssetManager.goldMines[5].centre);
|
||||
}
|
||||
}else {
|
||||
@ -147,113 +147,127 @@ public class unitProductionAI {
|
||||
}
|
||||
|
||||
|
||||
//make decision on what unit to produce
|
||||
int numberOfPlayerGunTurrets= mainThread.ec.theMapAwarenessAI.numberOfGunTurret_player;
|
||||
int numberOfPlayerMissileTurrets= mainThread.ec.theMapAwarenessAI.numberOfMissileTurret_player;
|
||||
int numberOfLightTanks_player = mainThread.ec.theMapAwarenessAI.numberOfLightTanks_player;
|
||||
int numberOfRocketTanks_player = mainThread.ec.theMapAwarenessAI.numberOfRocketTanks_player;
|
||||
int numberOfStealthTanks_player = mainThread.ec.theMapAwarenessAI.numberOfStealthTanks_player;
|
||||
int numberOfHeavyTanks_player = mainThread.ec.theMapAwarenessAI.numberOfHeavyTanks_player;
|
||||
int maxNumberOfStealthTanks_playerInLastFiveMinutes = mainThread.ec.theMapAwarenessAI.maxNumberOfStealthTanks_playerInLastFiveMinutes;
|
||||
|
||||
boolean playerHasMostlyLightTanks = mainThread.ec.theMapAwarenessAI.playerHasMostlyLightTanks;
|
||||
boolean playerHasMostlyHeavyTanks = mainThread.ec.theMapAwarenessAI.playerHasMostlyHeavyTanks;
|
||||
boolean playIsRushingHighTierUnits = mainThread.ec.theMapAwarenessAI.playIsRushingHighTierUnits;
|
||||
boolean playerLikelyCanNotProduceHighTierUnits = mainThread.ec.theMapAwarenessAI.playerLikelyCanNotProduceHighTierUnits;
|
||||
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;
|
||||
boolean playerArmyCanBeCounteredWithStealthTanks = mainThread.ec.theMapAwarenessAI.playerArmyCanBeCounteredWithStealthTanks;
|
||||
|
||||
int timeToBuildHeavyTank = 500;
|
||||
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 = 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 && numberOfHeavyTanksControlledByCombatAI < 20 && !(numberOfStealthTanksControlledByCombatAI < 1) && !playerHasMostlyHeavyTanks && !playerHasMostlyLightTanks && !playerHasMostlyLightAndStealthTanks && !playerArmyCanBeCounteredWithLightTanks && !playerArmyCanBeCounteredWithStealthTanks &&
|
||||
(playerHasMostlyHeavyAndStealthTanks || (frameAI > timeToBuildHeavyTank && numberOfHeavyTanks_AI < 3) ||
|
||||
!playerHasManyLightTanksButNoHeavyTank
|
||||
&& !(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 && ((numberOfStealthTanksControlledByCombatAI < 1) || (playerDoesntHaveMassHeavyTanks && !playerHasMostlyHeavyTanks && !playerArmyCanBeCounteredWithLightTanks && !(numberOfStealthTanksControlledByCombatAI >= 9 && frameAI < 600) && !(numberOfStealthTanksControlledByCombatAI >= 18 && 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) {
|
||||
if(!communicationCenter.rapidfireResearched_enemy) {
|
||||
if(communicationCenter.rapidfireResearchProgress_enemy == 255){
|
||||
communicationCenter.researchRapidfire(1);
|
||||
System.out.println("----------------------------AI starts researching rapid fire ability------------------------------------");
|
||||
if(mainThread.ec.difficulty > 0) {
|
||||
//make decision on what unit to produce
|
||||
int numberOfPlayerGunTurrets= mainThread.ec.theMapAwarenessAI.numberOfGunTurret_player;
|
||||
int numberOfPlayerMissileTurrets= mainThread.ec.theMapAwarenessAI.numberOfMissileTurret_player;
|
||||
int numberOfLightTanks_player = mainThread.ec.theMapAwarenessAI.numberOfLightTanks_player;
|
||||
int numberOfRocketTanks_player = mainThread.ec.theMapAwarenessAI.numberOfRocketTanks_player;
|
||||
int numberOfStealthTanks_player = mainThread.ec.theMapAwarenessAI.numberOfStealthTanks_player;
|
||||
int numberOfHeavyTanks_player = mainThread.ec.theMapAwarenessAI.numberOfHeavyTanks_player;
|
||||
int maxNumberOfStealthTanks_playerInLastFiveMinutes = mainThread.ec.theMapAwarenessAI.maxNumberOfStealthTanks_playerInLastFiveMinutes;
|
||||
|
||||
boolean playerHasMostlyLightTanks = mainThread.ec.theMapAwarenessAI.playerHasMostlyLightTanks;
|
||||
boolean playerHasMostlyHeavyTanks = mainThread.ec.theMapAwarenessAI.playerHasMostlyHeavyTanks;
|
||||
boolean playIsRushingHighTierUnits = mainThread.ec.theMapAwarenessAI.playIsRushingHighTierUnits;
|
||||
boolean playerLikelyCanNotProduceHighTierUnits = mainThread.ec.theMapAwarenessAI.playerLikelyCanNotProduceHighTierUnits;
|
||||
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;
|
||||
boolean playerArmyCanBeCounteredWithStealthTanks = mainThread.ec.theMapAwarenessAI.playerArmyCanBeCounteredWithStealthTanks;
|
||||
|
||||
int timeToBuildHeavyTank = 500;
|
||||
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 = 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 && numberOfHeavyTanksControlledByCombatAI < 20 && !(numberOfStealthTanksControlledByCombatAI < 1) && !playerHasMostlyHeavyTanks && !playerHasMostlyLightTanks && !playerHasMostlyLightAndStealthTanks && !playerArmyCanBeCounteredWithLightTanks && !playerArmyCanBeCounteredWithStealthTanks &&
|
||||
(playerHasMostlyHeavyAndStealthTanks || (frameAI > timeToBuildHeavyTank && numberOfHeavyTanks_AI < 3) ||
|
||||
!playerHasManyLightTanksButNoHeavyTank
|
||||
&& !(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 && ((numberOfStealthTanksControlledByCombatAI < 1) || (playerDoesntHaveMassHeavyTanks && !playerHasMostlyHeavyTanks && !playerArmyCanBeCounteredWithLightTanks && !(numberOfStealthTanksControlledByCombatAI >= 9 && frameAI < 600) && !(numberOfStealthTanksControlledByCombatAI >= 18 && 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 && mainThread.ec.difficulty > 1) {
|
||||
if(mainThread.ec.theDefenseManagerAI.needMissileTurret || theBaseInfo.currentCredit > 1500 && frameAI > 450) {
|
||||
if(!communicationCenter.rapidfireResearched_enemy) {
|
||||
if(communicationCenter.rapidfireResearchProgress_enemy == 255){
|
||||
communicationCenter.researchRapidfire(1);
|
||||
System.out.println("----------------------------AI starts researching rapid fire ability------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mainThread.ec.theEconomyManagerAI.numberOfharvesters >= 6 && theBaseInfo.currentCredit > 1500 && mainThread.ec.difficulty > 1) {
|
||||
if(!communicationCenter.harvesterSpeedResearched_enemy) {
|
||||
if(communicationCenter.harvesterSpeedResearchProgress_enemy == 255){
|
||||
communicationCenter.researchHarvesterSpeed(1);
|
||||
System.out.println("----------------------------AI starts researching harvester speed ability------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mainThread.ec.theEconomyManagerAI.numberOfharvesters >= 6 && theBaseInfo.currentCredit > 1500) {
|
||||
if(!communicationCenter.harvesterSpeedResearched_enemy) {
|
||||
if(communicationCenter.harvesterSpeedResearchProgress_enemy == 255){
|
||||
communicationCenter.researchHarvesterSpeed(1);
|
||||
System.out.println("----------------------------AI starts researching harvester speed ability------------------------------------");
|
||||
if(mainThread.ec.theBuildingManagerAI.theBaseInfo.numberOfTechCenter > 0){
|
||||
|
||||
//Immediately start stealth tank upgrades when a tech center is built
|
||||
if(!techCenter.stealthTankResearched_enemy){
|
||||
if(techCenter.stealthTankResearchProgress_enemy == 255){
|
||||
techCenter.cancelResearch(1);
|
||||
techCenter.researchStealthTank(1);
|
||||
System.out.println("----------------------------AI starts researching stealth tank------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mainThread.ec.theBuildingManagerAI.theBaseInfo.numberOfTechCenter > 0){
|
||||
|
||||
//Immediately start stealth tank upgrades when a tech center is built
|
||||
if(!techCenter.stealthTankResearched_enemy){
|
||||
if(techCenter.stealthTankResearchProgress_enemy == 255){
|
||||
techCenter.cancelResearch(1);
|
||||
techCenter.researchStealthTank(1);
|
||||
System.out.println("----------------------------AI starts researching stealth tank------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(numberOfLightTanks_AI >= 15 && theBaseInfo.currentCredit > 1000){
|
||||
if(!techCenter.lightTankResearched_enemy){
|
||||
if(techCenter.lightTankResearchProgress_enemy >= 240 && techCenter.stealthTankResearchProgress_enemy >= 240 && techCenter.rocketTankResearchProgress_enemy >= 240 && techCenter.heavyTankResearchProgress_enemy >= 240){
|
||||
techCenter.researchLightTank(1);
|
||||
System.out.println("----------------------------AI starts researching light tank------------------------------------");
|
||||
|
||||
if(numberOfLightTanks_AI >= 15 && theBaseInfo.currentCredit > 1000){
|
||||
if(!techCenter.lightTankResearched_enemy){
|
||||
if(techCenter.lightTankResearchProgress_enemy >= 240 && techCenter.stealthTankResearchProgress_enemy >= 240 && techCenter.rocketTankResearchProgress_enemy >= 240 && techCenter.heavyTankResearchProgress_enemy >= 240){
|
||||
techCenter.researchLightTank(1);
|
||||
System.out.println("----------------------------AI starts researching light tank------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(numberOfRocketTanks_AI > 2 && theBaseInfo.currentCredit > 1250 && (numberOfPlayerGunTurrets > 0 || numberOfPlayerMissileTurrets > 0 || frameAI > 600)){
|
||||
if(!techCenter.rocketTankResearched_enemy){
|
||||
if(techCenter.lightTankResearchProgress_enemy >= 240 && techCenter.stealthTankResearchProgress_enemy >= 240 && techCenter.rocketTankResearchProgress_enemy >= 240 && techCenter.heavyTankResearchProgress_enemy >= 240){
|
||||
|
||||
techCenter.researchRocketTank(1);
|
||||
System.out.println("----------------------------AI starts researching rocket tank------------------------------------");
|
||||
|
||||
if(numberOfRocketTanks_AI > 2 && theBaseInfo.currentCredit > 1250 && (numberOfPlayerGunTurrets > 0 || numberOfPlayerMissileTurrets > 0 || frameAI > 600)){
|
||||
if(!techCenter.rocketTankResearched_enemy){
|
||||
if(techCenter.lightTankResearchProgress_enemy >= 240 && techCenter.stealthTankResearchProgress_enemy >= 240 && techCenter.rocketTankResearchProgress_enemy >= 240 && techCenter.heavyTankResearchProgress_enemy >= 240){
|
||||
|
||||
techCenter.researchRocketTank(1);
|
||||
System.out.println("----------------------------AI starts researching rocket tank------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(numberOfHeavyTanks_AI > 5 && theBaseInfo.currentCredit > 1000){
|
||||
if(!techCenter.heavyTankResearched_enemy){
|
||||
if(techCenter.lightTankResearchProgress_enemy >= 240 && techCenter.stealthTankResearchProgress_enemy >= 240 && techCenter.rocketTankResearchProgress_enemy >= 240 && techCenter.heavyTankResearchProgress_enemy >= 240){
|
||||
techCenter.researchHeavyTank(1);
|
||||
System.out.println("----------------------------AI starts researching heavy tank------------------------------------");
|
||||
|
||||
if(numberOfHeavyTanks_AI > 5 && theBaseInfo.currentCredit > 1000){
|
||||
if(!techCenter.heavyTankResearched_enemy){
|
||||
if(techCenter.lightTankResearchProgress_enemy >= 240 && techCenter.stealthTankResearchProgress_enemy >= 240 && techCenter.rocketTankResearchProgress_enemy >= 240 && techCenter.heavyTankResearchProgress_enemy >= 240){
|
||||
techCenter.researchHeavyTank(1);
|
||||
System.out.println("----------------------------AI starts researching heavy tank------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}else {
|
||||
int roll = gameData.getRandom();
|
||||
if(roll < 612) {
|
||||
currentProductionOrder = produceLightTank;
|
||||
}else if(roll >= 612 && roll < 700) {
|
||||
currentProductionOrder = produceRocketTank;
|
||||
}else if(roll >= 700 && roll < 900) {
|
||||
currentProductionOrder = produceStealthTank;
|
||||
}else {
|
||||
currentProductionOrder = produceHeavyTank;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -301,7 +315,8 @@ public class unitProductionAI {
|
||||
for(int i = 0; i < lightTanksControlledByCombatAI.length; i++){
|
||||
if(lightTanksControlledByCombatAI[i] == null || (lightTanksControlledByCombatAI[i] != null && lightTanksControlledByCombatAI[i].currentHP <=0)){
|
||||
lightTanksControlledByCombatAI[i] = o;
|
||||
mainThread.ec.theDefenseManagerAI.addUnitToDefenders(o);
|
||||
if(mainThread.ec.difficulty > 0)
|
||||
mainThread.ec.theDefenseManagerAI.addUnitToDefenders(o);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -340,8 +355,8 @@ public class unitProductionAI {
|
||||
for(int i = 0; i < stealthTanksControlledByCombatAI.length; i++){
|
||||
if(stealthTanksControlledByCombatAI[i] == null || (stealthTanksControlledByCombatAI[i] != null && stealthTanksControlledByCombatAI[i].currentHP <=0)){
|
||||
stealthTanksControlledByCombatAI[i] = o;
|
||||
|
||||
mainThread.ec.theDefenseManagerAI.addUnitToDefenders(o);
|
||||
if(mainThread.ec.difficulty > 0)
|
||||
mainThread.ec.theDefenseManagerAI.addUnitToDefenders(o);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user