diff --git a/core/AssetManager.java b/core/AssetManager.java index a992486..2fdcdaf 100644 --- a/core/AssetManager.java +++ b/core/AssetManager.java @@ -233,9 +233,9 @@ public class AssetManager { for(int j = 0; j < 10; j++){ //if(i == 0) { - //rocketTank l = new rocketTank(new vector(j*0.25f+ 1.125f,-0.3f, 22.125f - i*0.25f), 90, 1); + rocketTank l = new rocketTank(new vector(j*0.25f+ 1.125f,-0.3f, 22.125f - i*0.25f), 90, 1); //l.damageMultiplier =2; - //addRocketTank(l); + addRocketTank(l); //techCenter.rocketTankResearched_enemy = true; //}else { @@ -251,8 +251,8 @@ public class AssetManager { for(int i = 0; i < 10; i ++){ for(int j = 0; j < 6; j++){ - stealthTank l = new stealthTank(new vector(i*0.25f+ 1.125f,-0.3f, 17.375f - 0.25f*j), 90, 0); - addStealthTank(l); + //lightTank l = new lightTank(new vector(i*0.25f+ 1.125f,-0.3f, 17.375f - 0.25f*j), 90, 0); + //addLightTank(l); //l.hasMultiShotUpgrade = true; //lightTank l = new lightTank(new vector(i*0.25f + 1.125f,-0.3f, 0.5f + 18.625f + j*0.25f), 90, 0); @@ -261,7 +261,7 @@ public class AssetManager { //lightTank.tileCheckList_player = lightTank.generateTileCheckList(6); //addLightTank(l); - //addMissileTurret(new missileTurret(i*0.25f -0.125f + 1, -0.65f, 0.25f + 16.125f + j*0.25f, 0)); + addGunTurret(new gunTurret(i*0.25f -0.125f + 13, -0.65f, 0.25f + 20.125f + j*0.25f, 0)); } } diff --git a/enemyAI/combatManagerAI.java b/enemyAI/combatManagerAI.java index c12cc36..5b51fe9 100644 --- a/enemyAI/combatManagerAI.java +++ b/enemyAI/combatManagerAI.java @@ -510,7 +510,7 @@ public class combatManagerAI { break; } - boolean playerForceIsMuchWeakerThanAI = checkIfAIHasBiggerForce(0.2f); + boolean playerForceIsMuchWeakerThanAI = checkIfAIHasBiggerForce(0.5f); for(int i = 0; i < mainThread.ec.theUnitProductionAI.numberOfCombatUnit; i++){ if(team[i] != null && team[i].currentHP > 0){ @@ -554,8 +554,11 @@ public class combatManagerAI { } } } + System.out.println(!playerForceIsMuchWeakerThanAI + " " + mainThread.ec.theMapAwarenessAI.playerAssetDestoryedCountDown); } + + //make sure idle units are send to attack unNeutralized target if(unNeutralizedEntity != null){ for(int i = 0; i < mainThread.ec.theUnitProductionAI.numberOfCombatUnit; i++){ diff --git a/enemyAI/mapAwarenessAI.java b/enemyAI/mapAwarenessAI.java index 73b95a1..9e22a08 100644 --- a/enemyAI/mapAwarenessAI.java +++ b/enemyAI/mapAwarenessAI.java @@ -151,7 +151,7 @@ public class mapAwarenessAI { numOfAIStructures = 0; if(playerAssetDestoryedCountDown > 0) - playerAssetDestoryedCountDown = 0; + playerAssetDestoryedCountDown--; for(int i = 0; i < theAssetManager.lightTanks.length; i++){ @@ -431,7 +431,7 @@ public class mapAwarenessAI { playerAssetDestoryedCountDown = 30; } - numberOfPlayerUnitDestroyedInPreviousFrame = playerAssetDestoryedCountDown; + numberOfPlayerUnitDestroyedInPreviousFrame = numberOfPlayerUnitDestroyed; numberOfPlayerBuildingDestroyedPreviousFrame = numberOfPlayerBuildingDestroyed; //analyze the enemy units composition diff --git a/enemyAI/microManagementAI.java b/enemyAI/microManagementAI.java index c12b915..391c93a 100644 --- a/enemyAI/microManagementAI.java +++ b/enemyAI/microManagementAI.java @@ -4,6 +4,7 @@ import core.baseInfo; import core.mainThread; import entity.solidObject; import entity.techCenter; +import entity.rocketTank; //micro manage the units on the battle field to trade units better against player @@ -63,6 +64,44 @@ public class microManagementAI { //micro rocket tanks, so they don't overkill targets, if(unitInCombatRadius[i].type == 1) { + float myRange= (unitInCombatRadius[i].attackRange) * (unitInCombatRadius[i].attackRange); + float scanRange = (unitInCombatRadius[i].attackRange + 1.5f) * (unitInCombatRadius[i].attackRange+1.5f); + + //Prioritize searching for targets among static defenses + boolean suitableTargertFound = false; + for(int j = 0; j < playerStaticDefenceInMinimap.length; j++) { + if(playerStaticDefenceInMinimap[j] != null && !playerStaticDefenceInMinimap[j].willDieFromIncomingAttack()){ + x1 = playerStaticDefenceInMinimap[j].centre.x; + x2 = unitInCombatRadius[i].centre.x; + z1 = playerStaticDefenceInMinimap[j].centre.z; + z2 = unitInCombatRadius[i].centre.z; + float distanceToDesination = (x1 - x2)*(x1 - x2) + (z1 - z2)*(z1 - z2); + if(distanceToDesination < scanRange){ + unitInCombatRadius[i].attack(playerStaticDefenceInMinimap[j]); + + unitInCombatRadius[i].currentCommand = solidObject.attackCautiously; + unitInCombatRadius[i].secondaryCommand = solidObject.StandBy; + + suitableTargertFound = true; + + if(distanceToDesination < myRange) { + int myDamage = unitInCombatRadius[i].myDamage; + if(techCenter.rocketTankResearched_enemy) { + myDamage*=2; + } + myDamage = (int)(myDamage*rocketTank.damageAginstBuildingMulitplier); + + playerStaticDefenceInMinimap[j].incomingDamage+=myDamage*2; + } + break; + } + } + } + + if(suitableTargertFound) + continue; + + //if rocket tank has no target or the target will die from incoming attack, find a new target if(unitInCombatRadius[i].targetObject != null && !unitInCombatRadius[i].targetObject.willDieFromIncomingAttack()) { @@ -71,46 +110,14 @@ public class microManagementAI { if(techCenter.rocketTankResearched_enemy) { myDamage*=2; } - myDamage = (int)(myDamage*1.25f); + myDamage = (int)(myDamage*rocketTank.damageAginstBuildingMulitplier); } unitInCombatRadius[i].targetObject.incomingDamage+=myDamage*2; }else { - float myRange= (unitInCombatRadius[i].attackRange+2f) * (unitInCombatRadius[i].attackRange+2f); - //Prioritize searching for targets among static defenses - boolean suitableTargertFound = false; - for(int j = 0; j < playerStaticDefenceInMinimap.length; j++) { - if(playerStaticDefenceInMinimap[j] != null && !playerStaticDefenceInMinimap[j].willDieFromIncomingAttack()){ - x1 = playerStaticDefenceInMinimap[j].centre.x; - x2 = unitInCombatRadius[i].centre.x; - z1 = playerStaticDefenceInMinimap[j].centre.z; - z2 = unitInCombatRadius[i].centre.z; - float distanceToDesination = (x1 - x2)*(x1 - x2) + (z1 - z2)*(z1 - z2); - if(distanceToDesination < myRange){ - unitInCombatRadius[i].attack(playerStaticDefenceInMinimap[j]); - - unitInCombatRadius[i].currentCommand = solidObject.attackCautiously; - - suitableTargertFound = true; - - - int myDamage = unitInCombatRadius[i].myDamage; - if(techCenter.rocketTankResearched_enemy) { - myDamage*=2; - } - myDamage = (int)(myDamage*1.25f); - - playerStaticDefenceInMinimap[j].incomingDamage+=myDamage*2; - break; - } - } - } - - if(suitableTargertFound) - continue; //find targets among moving unites diff --git a/entity/rocketTank.java b/entity/rocketTank.java index cf77bc2..a5b731c 100644 --- a/entity/rocketTank.java +++ b/entity/rocketTank.java @@ -40,8 +40,6 @@ public class rocketTank extends solidObject{ //destination angle public int destinationAngle; - - //whether light tank has ling of sight to its target public boolean hasLineOfSightToTarget; @@ -73,6 +71,7 @@ public class rocketTank extends solidObject{ public static int[] tileCheckList; public int damageMultiplier = 1; + public final static float damageAginstBuildingMulitplier = 1.25f; public rocketTank(vector origin, int bodyAngle, int teamNo){ @@ -1035,7 +1034,7 @@ public class rocketTank extends solidObject{ float multiplier = 1; if(targetObject.type > 100){ multiplier = damageMultiplier; - multiplier*=1.25f; + multiplier*=damageAginstBuildingMulitplier; } if(attackCoolDown == 0 && targetObject.currentHP >0 ){