From 7212008673ebf893fb3fdaa4a0e2f11574121021 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 3 Apr 2019 16:58:13 +1300 Subject: [PATCH] home commit --- core/mainThread.java | 4 ++-- enemyAI/baseExpensionAI.java | 5 +---- enemyAI/combatManagerAI.java | 4 ++-- enemyAI/mapAwarenessAI.java | 8 +++++--- enemyAI/unitProductionAI.java | 3 +++ gui/gameMenu.java | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/core/mainThread.java b/core/mainThread.java index 66be6cb..9ab98bd 100644 --- a/core/mainThread.java +++ b/core/mainThread.java @@ -504,7 +504,7 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M sleepTime = 0; - while(System.currentTimeMillis()-lastDraw= 17500 && (mainThread.ec.theEconomyManagerAI.preferedGoldMine.goldDeposite < lowGoldmineThreshold || (mainThread.ec.theEconomyManagerAI.preferedGoldMine == expensionGoldMine && !hasConstructionYardNearGoldMine(expensionGoldMine) && !hasRefineryNearTheGoldmine(expensionGoldMine)))){ diff --git a/enemyAI/combatManagerAI.java b/enemyAI/combatManagerAI.java index c30fd3e..bc6412a 100644 --- a/enemyAI/combatManagerAI.java +++ b/enemyAI/combatManagerAI.java @@ -93,8 +93,8 @@ public class combatManagerAI { //assume player force gets stronger as time goes by if(unrevealedPlayerForceStrength < 0) unrevealedPlayerForceStrength = 0; - if(noPlayerActivityCountdown > 0) - unrevealedPlayerForceStrength+=0.1f; + if(noPlayerActivityCountdown > 0 && mainThread.ec.theMapAwarenessAI.totalNumberOfPlayerUnits > 0) + unrevealedPlayerForceStrength+=0.075f; if(withdrawUnitOutsideCombatRadiusCooldown > 0){ withdrawUnitOutsideCombatRadiusCooldown --; diff --git a/enemyAI/mapAwarenessAI.java b/enemyAI/mapAwarenessAI.java index d0fc0b7..e5272f6 100644 --- a/enemyAI/mapAwarenessAI.java +++ b/enemyAI/mapAwarenessAI.java @@ -21,6 +21,7 @@ public class mapAwarenessAI { public int numberOfRocketTanks_player, numberOfRocketTanks_AI, numberOfRocketTanksOnMinimap_player; public int numberOfHeavyTanks_player, numberOfHeavyTanks_AI, numberOfHeavyTanksOnMinimap_player; public int numberOfPlayerUnitsOnMinimap; + public int totalNumberOfPlayerUnits; public int numberOfGunTurret_player; public int numberOfMissileTurret_player; public int numberOfFactory_player; @@ -436,11 +437,12 @@ public class mapAwarenessAI { numberOfPlayerBuildingDestroyedPreviousFrame = numberOfPlayerBuildingDestroyed; //analyze the enemy units composition + totalNumberOfPlayerUnits = numberOfLightTanks_player + numberOfRocketTanks_player + numberOfStealthTanks_player + numberOfHeavyTanks_player; - float lightTankRatio = (float)(numberOfLightTanks_player)/(numberOfLightTanks_player + numberOfRocketTanks_player + numberOfStealthTanks_player + numberOfHeavyTanks_player + 1); + float lightTankRatio = (float)(numberOfLightTanks_player)/(totalNumberOfPlayerUnits + 1); playerHasMostlyLightTanks = numberOfLightTanks_player > 5 && lightTankRatio > 0.8f; - playerHasMostlyHeavyTanks = numberOfHeavyTanks_player > 3 && (float)(numberOfHeavyTanks_player)/(numberOfLightTanks_player + numberOfRocketTanks_player + numberOfStealthTanks_player + numberOfHeavyTanks_player) > 0.6f; + playerHasMostlyHeavyTanks = numberOfHeavyTanks_player > 3 && (float)(numberOfHeavyTanks_player)/(totalNumberOfPlayerUnits) > 0.6f; playerHasManyLightTanksButNoHeavyTank = lightTankRatio > 0.5 && lightTankRatio <=0.8 && numberOfHeavyTanks_player < 3; playIsRushingHighTierUnits = mainThread.gameFrame/30 > 250 && mainThread.gameFrame/30 < 400 @@ -454,7 +456,7 @@ public class mapAwarenessAI { playerIsRushingLightTank = mainThread.gameFrame/30 > 300 && mainThread.gameFrame/30 < 600 && ((playerLikelyCanNotProduceHighTierUnits && numberOfStealthTanks_player < 3) || playerHasMostlyLightTanks); - playerHasMostlyHeavyAndStealthTanks = (maxNumberOfStealthTanks_playerInLastFiveMinutes >=2 ) && (float)(numberOfHeavyTanks_player + numberOfStealthTanks_player)/(numberOfLightTanks_player + numberOfRocketTanks_player + numberOfStealthTanks_player + numberOfHeavyTanks_player) > 0.8f; + playerHasMostlyHeavyAndStealthTanks = (maxNumberOfStealthTanks_playerInLastFiveMinutes >=2 ) && (float)(numberOfHeavyTanks_player + numberOfStealthTanks_player)/totalNumberOfPlayerUnits > 0.8f; //advanced counting of player units diff --git a/enemyAI/unitProductionAI.java b/enemyAI/unitProductionAI.java index eb47424..489451e 100644 --- a/enemyAI/unitProductionAI.java +++ b/enemyAI/unitProductionAI.java @@ -115,6 +115,9 @@ public class unitProductionAI { rallyPoint.set(mainThread.theAssetManager.constructionYards[index].centre.x - 2.5f, 0, mainThread.theAssetManager.constructionYards[index].centre.z -2.5f); } + //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. + //make sure not to over produce when the resource is running low diff --git a/gui/gameMenu.java b/gui/gameMenu.java index 1e6625c..37dc009 100644 --- a/gui/gameMenu.java +++ b/gui/gameMenu.java @@ -99,7 +99,7 @@ public class gameMenu { + " Light Tank -- Cheap but lightly armored. Has moderate movement speed \n and firepower. It can be considered as the jack of all trades. It can be \n upgraded to have increased range.\n\n" + " Rocket Tank -- A slow moving and lightly armored unit. It has long reload \n time but can out range static defenses. It does extra damage to buildings \n and can be upgraded to deal even more damage to buildings.\n\n" + " Stealth Tank -- Fast but lightly armoured. It has a passive cloak ablility that \n turns the tank invisible when not attacking. It does more damage to light \n armoured unit but significantly less damage to heavy armoured unit. It can \n be upgraded to damage multiple units in one shot.\n\n" - + " Heavy Tank -- Slowest and the most expensive tank in the game. Equiped \n with twin cannons, it is a moving fortress. It can be upgraded with self \n repair capability so it can last even longer in battle field.\n\n\n\n" + + " Heavy Tank -- The Slowest and most expensive tank in the game. Equiped \n with twin cannons, it is a moving fortress. It can be upgraded with self \n repair capability so it can last even longer in battle field.\n\n\n\n" + " 2/3 ").toCharArray(); helpPage3 = (" About Me \n\n"