home
This commit is contained in:
parent
47bbd6df07
commit
eafa1e27f2
@ -233,9 +233,9 @@ public class AssetManager {
|
|||||||
for(int j = 0; j < 10; j++){
|
for(int j = 0; j < 10; j++){
|
||||||
|
|
||||||
//if(i == 0) {
|
//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;
|
//l.damageMultiplier =2;
|
||||||
//addRocketTank(l);
|
addRocketTank(l);
|
||||||
//techCenter.rocketTankResearched_enemy = true;
|
//techCenter.rocketTankResearched_enemy = true;
|
||||||
|
|
||||||
//}else {
|
//}else {
|
||||||
@ -251,8 +251,8 @@ public class AssetManager {
|
|||||||
for(int i = 0; i < 10; i ++){
|
for(int i = 0; i < 10; i ++){
|
||||||
|
|
||||||
for(int j = 0; j < 6; j++){
|
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);
|
//lightTank l = new lightTank(new vector(i*0.25f+ 1.125f,-0.3f, 17.375f - 0.25f*j), 90, 0);
|
||||||
addStealthTank(l);
|
//addLightTank(l);
|
||||||
//l.hasMultiShotUpgrade = true;
|
//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);
|
//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);
|
//lightTank.tileCheckList_player = lightTank.generateTileCheckList(6);
|
||||||
|
|
||||||
//addLightTank(l);
|
//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));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ public class combatManagerAI {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean playerForceIsMuchWeakerThanAI = checkIfAIHasBiggerForce(0.2f);
|
boolean playerForceIsMuchWeakerThanAI = checkIfAIHasBiggerForce(0.5f);
|
||||||
|
|
||||||
for(int i = 0; i < mainThread.ec.theUnitProductionAI.numberOfCombatUnit; i++){
|
for(int i = 0; i < mainThread.ec.theUnitProductionAI.numberOfCombatUnit; i++){
|
||||||
if(team[i] != null && team[i].currentHP > 0){
|
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
|
//make sure idle units are send to attack unNeutralized target
|
||||||
if(unNeutralizedEntity != null){
|
if(unNeutralizedEntity != null){
|
||||||
for(int i = 0; i < mainThread.ec.theUnitProductionAI.numberOfCombatUnit; i++){
|
for(int i = 0; i < mainThread.ec.theUnitProductionAI.numberOfCombatUnit; i++){
|
||||||
|
@ -151,7 +151,7 @@ public class mapAwarenessAI {
|
|||||||
numOfAIStructures = 0;
|
numOfAIStructures = 0;
|
||||||
|
|
||||||
if(playerAssetDestoryedCountDown > 0)
|
if(playerAssetDestoryedCountDown > 0)
|
||||||
playerAssetDestoryedCountDown = 0;
|
playerAssetDestoryedCountDown--;
|
||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < theAssetManager.lightTanks.length; i++){
|
for(int i = 0; i < theAssetManager.lightTanks.length; i++){
|
||||||
@ -431,7 +431,7 @@ public class mapAwarenessAI {
|
|||||||
playerAssetDestoryedCountDown = 30;
|
playerAssetDestoryedCountDown = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
numberOfPlayerUnitDestroyedInPreviousFrame = playerAssetDestoryedCountDown;
|
numberOfPlayerUnitDestroyedInPreviousFrame = numberOfPlayerUnitDestroyed;
|
||||||
numberOfPlayerBuildingDestroyedPreviousFrame = numberOfPlayerBuildingDestroyed;
|
numberOfPlayerBuildingDestroyedPreviousFrame = numberOfPlayerBuildingDestroyed;
|
||||||
|
|
||||||
//analyze the enemy units composition
|
//analyze the enemy units composition
|
||||||
|
@ -4,6 +4,7 @@ import core.baseInfo;
|
|||||||
import core.mainThread;
|
import core.mainThread;
|
||||||
import entity.solidObject;
|
import entity.solidObject;
|
||||||
import entity.techCenter;
|
import entity.techCenter;
|
||||||
|
import entity.rocketTank;
|
||||||
|
|
||||||
//micro manage the units on the battle field to trade units better against player
|
//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,
|
//micro rocket tanks, so they don't overkill targets,
|
||||||
if(unitInCombatRadius[i].type == 1) {
|
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 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()) {
|
if(unitInCombatRadius[i].targetObject != null && !unitInCombatRadius[i].targetObject.willDieFromIncomingAttack()) {
|
||||||
|
|
||||||
@ -71,46 +110,14 @@ public class microManagementAI {
|
|||||||
if(techCenter.rocketTankResearched_enemy) {
|
if(techCenter.rocketTankResearched_enemy) {
|
||||||
myDamage*=2;
|
myDamage*=2;
|
||||||
}
|
}
|
||||||
myDamage = (int)(myDamage*1.25f);
|
myDamage = (int)(myDamage*rocketTank.damageAginstBuildingMulitplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
unitInCombatRadius[i].targetObject.incomingDamage+=myDamage*2;
|
unitInCombatRadius[i].targetObject.incomingDamage+=myDamage*2;
|
||||||
|
|
||||||
}else {
|
}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
|
//find targets among moving unites
|
||||||
|
@ -40,8 +40,6 @@ public class rocketTank extends solidObject{
|
|||||||
//destination angle
|
//destination angle
|
||||||
public int destinationAngle;
|
public int destinationAngle;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//whether light tank has ling of sight to its target
|
//whether light tank has ling of sight to its target
|
||||||
public boolean hasLineOfSightToTarget;
|
public boolean hasLineOfSightToTarget;
|
||||||
@ -73,6 +71,7 @@ public class rocketTank extends solidObject{
|
|||||||
public static int[] tileCheckList;
|
public static int[] tileCheckList;
|
||||||
|
|
||||||
public int damageMultiplier = 1;
|
public int damageMultiplier = 1;
|
||||||
|
public final static float damageAginstBuildingMulitplier = 1.25f;
|
||||||
|
|
||||||
|
|
||||||
public rocketTank(vector origin, int bodyAngle, int teamNo){
|
public rocketTank(vector origin, int bodyAngle, int teamNo){
|
||||||
@ -1035,7 +1034,7 @@ public class rocketTank extends solidObject{
|
|||||||
float multiplier = 1;
|
float multiplier = 1;
|
||||||
if(targetObject.type > 100){
|
if(targetObject.type > 100){
|
||||||
multiplier = damageMultiplier;
|
multiplier = damageMultiplier;
|
||||||
multiplier*=1.25f;
|
multiplier*=damageAginstBuildingMulitplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(attackCoolDown == 0 && targetObject.currentHP >0 ){
|
if(attackCoolDown == 0 && targetObject.currentHP >0 ){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user