This commit is contained in:
Pan 2019-04-26 19:51:58 +12:00
parent f734c09fc6
commit 6ecad7b40f
6 changed files with 10 additions and 25 deletions

View File

@ -405,7 +405,7 @@ public class playerCommander {
if(selectedConyardID != -1) { if(selectedConyardID != -1) {
for(int i = 0; i < constructionYards.length; i++) { for(int i = 0; i < constructionYards.length; i++) {
if(constructionYards[i].ID == selectedConyardID) { if(constructionYards[i] != null && constructionYards[i].ID == selectedConyardID) {
conyardIndex = i; conyardIndex = i;
break; break;
} }

View File

@ -1,6 +1,7 @@
package enemyAI; package enemyAI;
import core.baseInfo; import core.baseInfo;
import core.gameData;
import core.mainThread; import core.mainThread;
import core.vector; import core.vector;
import entity.goldMine; import entity.goldMine;
@ -67,7 +68,7 @@ public class combatManagerAI {
this.theBaseInfo = mainThread.ec.theBaseInfo; this.theBaseInfo = mainThread.ec.theBaseInfo;
standardAttackTime = 600; standardAttackTime = 600;
rushAttackTime = 300; rushAttackTime = 330 + gameData.getRandom()/4;
goldMines = mainThread.theAssetManager.goldMines; goldMines = mainThread.theAssetManager.goldMines;

View File

@ -65,7 +65,7 @@ public class enemyCommander {
thinkHardLikeHumanPlayer(); thinkHardLikeHumanPlayer();
drawVisionMap(); //drawVisionMap();
//reset tempBitmap; //reset tempBitmap;
for(int i = 0 ;i < tempBitmap.length; i++){ for(int i = 0 ;i < tempBitmap.length; i++){

View File

@ -26,7 +26,8 @@ public class harassmentAI {
miniFrameAI++; miniFrameAI++;
frameAI = mainThread.ec.frameAI; frameAI = mainThread.ec.frameAI;
if(miniFrameAI%30 == 29)
System.out.println(frameAI + " " + mainThread.ec.theCombatManagerAI.rushAttackTime);
} }

View File

@ -516,24 +516,7 @@ public class mapAwarenessAI {
if(playerIsFastExpanding) { if(playerIsFastExpanding) {
//check if there is any static defense around player's natural if(mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(0.5f))
boolean staticDefenceNearPlayerExpansion = false;
solidObject[] playerStaticDefence = mainThread.ec.theMapAwarenessAI.playerStaticDefenceInMinimap;
for(int i = 0; i < playerStaticDefence.length; i++) {
if(playerStaticDefence[i] != null && playerStaticDefence[i].currentHP > 0) {
float x1 = playerStaticDefence[i].centre.x;
float z1 = playerStaticDefence[i].centre.z;
float x2 = playerNaturalLocation.x;
float z2 = playerNaturalLocation.z;
if(Math.sqrt((x1-x2)*(x1-x2) + (z1-z2)*(z1-z2)) < 3f) {
staticDefenceNearPlayerExpansion = true;
break;
}
}
}
if(!staticDefenceNearPlayerExpansion)
canRushPlayer = true; canRushPlayer = true;
} }

View File

@ -122,9 +122,9 @@ public class unitProductionAI {
//If the difficulty is set to normal or hard, set the rally point just outside of player's natural expansion. //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. //So if the player is going for a fast expansion and don't have much units, the AI can perform a rush attack.
if(mainThread.ec.theMapAwarenessAI.canRushPlayer && frameAI < 360 && mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(1f)) { //if(mainThread.ec.theMapAwarenessAI.canRushPlayer && frameAI < 360 && mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(0.75f)) {
rallyPoint.set(rushRallyPointX, 0, rushRallyPointZ); // rallyPoint.set(rushRallyPointX, 0, rushRallyPointZ);
} //}
//make sure not to over produce when the resource is running low //make sure not to over produce when the resource is running low
int maxNumOfUnitCanBeProduced = theBaseInfo.currentCredit / 500 + 1; int maxNumOfUnitCanBeProduced = theBaseInfo.currentCredit / 500 + 1;