From 6ecad7b40fe18558ef7d2b778fac64f2b215b0a1 Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 26 Apr 2019 19:51:58 +1200 Subject: [PATCH] home --- core/playerCommander.java | 2 +- enemyAI/combatManagerAI.java | 3 ++- enemyAI/enemyCommander.java | 2 +- enemyAI/harassmentAI.java | 3 ++- enemyAI/mapAwarenessAI.java | 19 +------------------ enemyAI/unitProductionAI.java | 6 +++--- 6 files changed, 10 insertions(+), 25 deletions(-) diff --git a/core/playerCommander.java b/core/playerCommander.java index 12b6270..0a8ef21 100644 --- a/core/playerCommander.java +++ b/core/playerCommander.java @@ -405,7 +405,7 @@ public class playerCommander { if(selectedConyardID != -1) { for(int i = 0; i < constructionYards.length; i++) { - if(constructionYards[i].ID == selectedConyardID) { + if(constructionYards[i] != null && constructionYards[i].ID == selectedConyardID) { conyardIndex = i; break; } diff --git a/enemyAI/combatManagerAI.java b/enemyAI/combatManagerAI.java index e890b03..225db54 100644 --- a/enemyAI/combatManagerAI.java +++ b/enemyAI/combatManagerAI.java @@ -1,6 +1,7 @@ package enemyAI; import core.baseInfo; +import core.gameData; import core.mainThread; import core.vector; import entity.goldMine; @@ -67,7 +68,7 @@ public class combatManagerAI { this.theBaseInfo = mainThread.ec.theBaseInfo; standardAttackTime = 600; - rushAttackTime = 300; + rushAttackTime = 330 + gameData.getRandom()/4; goldMines = mainThread.theAssetManager.goldMines; diff --git a/enemyAI/enemyCommander.java b/enemyAI/enemyCommander.java index 597f10e..b6e7229 100644 --- a/enemyAI/enemyCommander.java +++ b/enemyAI/enemyCommander.java @@ -65,7 +65,7 @@ public class enemyCommander { thinkHardLikeHumanPlayer(); - drawVisionMap(); + //drawVisionMap(); //reset tempBitmap; for(int i = 0 ;i < tempBitmap.length; i++){ diff --git a/enemyAI/harassmentAI.java b/enemyAI/harassmentAI.java index 393b421..52e4fc2 100644 --- a/enemyAI/harassmentAI.java +++ b/enemyAI/harassmentAI.java @@ -26,7 +26,8 @@ public class harassmentAI { miniFrameAI++; frameAI = mainThread.ec.frameAI; - + if(miniFrameAI%30 == 29) + System.out.println(frameAI + " " + mainThread.ec.theCombatManagerAI.rushAttackTime); } diff --git a/enemyAI/mapAwarenessAI.java b/enemyAI/mapAwarenessAI.java index 8efed12..fad96b1 100644 --- a/enemyAI/mapAwarenessAI.java +++ b/enemyAI/mapAwarenessAI.java @@ -516,24 +516,7 @@ public class mapAwarenessAI { if(playerIsFastExpanding) { - //check if there is any static defense around player's natural - 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) + if(mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(0.5f)) canRushPlayer = true; } diff --git a/enemyAI/unitProductionAI.java b/enemyAI/unitProductionAI.java index 610befc..085fc1c 100644 --- a/enemyAI/unitProductionAI.java +++ b/enemyAI/unitProductionAI.java @@ -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. //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)) { - rallyPoint.set(rushRallyPointX, 0, rushRallyPointZ); - } + //if(mainThread.ec.theMapAwarenessAI.canRushPlayer && frameAI < 360 && mainThread.ec.theCombatManagerAI.checkIfAIHasBiggerForce(0.75f)) { + // rallyPoint.set(rushRallyPointX, 0, rushRallyPointZ); + //} //make sure not to over produce when the resource is running low int maxNumOfUnitCanBeProduced = theBaseInfo.currentCredit / 500 + 1;