commit from work
This commit is contained in:
parent
44511cf577
commit
0198d3c2a6
@ -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++){
|
||||||
//heavyTank l = new heavyTank(new vector(i*0.25f+ 1.125f,-0.3f, 17.375f - 0.25f*j), 90, 0);
|
heavyTank l = new heavyTank(new vector(i*0.25f+ 1.125f,-0.3f, 17.375f - 0.25f*j), 90, 0);
|
||||||
//addHeavyTank(l);
|
addHeavyTank(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);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ public class defenseManagerAI {
|
|||||||
public solidObject[] stealthTanksControlledByCombatAI;
|
public solidObject[] stealthTanksControlledByCombatAI;
|
||||||
|
|
||||||
public solidObject[] defenders;
|
public solidObject[] defenders;
|
||||||
|
public int numOfDefenders;
|
||||||
|
|
||||||
public vector direction;
|
public vector direction;
|
||||||
|
|
||||||
@ -125,12 +126,53 @@ public class defenseManagerAI {
|
|||||||
minorThreatLocation.reset();
|
minorThreatLocation.reset();
|
||||||
majorThreatLocation.reset();
|
majorThreatLocation.reset();
|
||||||
|
|
||||||
|
|
||||||
// if the size of the player unit cluster is less than 5, and no heavy tanks in the cluster, then borrow some unites from combatAI to deal with the threat
|
// if the size of the player unit cluster is less than 5, and no heavy tanks in the cluster, then borrow some unites from combatAI to deal with the threat
|
||||||
//if(mainPlayerForceSize < 5 && playerForceContainsNoHeavyTank(mainPlayerForceLocation) && playerForceIsNearBase(mainPlayerForceLocation)) {
|
//if(mainPlayerForceSize < 5 && playerForceContainsNoHeavyTank(mainPlayerForceLocation) && playerForceIsNearBase(mainPlayerForceLocation)) {
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
System.out.println(playerForceContainsNoHeavyTank(mainPlayerForceLocation));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean playerForceIsNearBase(vector location) {
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean playerForceContainsNoHeavyTank(vector location) {
|
||||||
|
solidObject o = null;
|
||||||
|
for(int i = 0; i < mainThread.ec.theMapAwarenessAI.playerUnitInMinimap.length; i++) {
|
||||||
|
o = mainThread.ec.theMapAwarenessAI.playerUnitInMinimap[i];
|
||||||
|
if(o !=null && o.currentHP > 0 && o.type == 7 && (o.centre.x - location.x)*(o.centre.x - location.x) + (o.centre.z - location.z)*(o.centre.z - location.z) < 4)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUnitToDefenders(solidObject o) {
|
||||||
|
numOfDefenders = 0;
|
||||||
|
for(int i = 0; i < defenders.length; i++) {
|
||||||
|
if(defenders[i] != null && defenders[i].currentHP > 0)
|
||||||
|
numOfDefenders++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(numOfDefenders == defenders.length && minorThreatLocation.x == 0) {
|
||||||
|
for(int i = defenders.length - 1; i > 0; i--)
|
||||||
|
defenders[i] = defenders[i - 1];
|
||||||
|
defenders[0] = o;
|
||||||
|
}else {
|
||||||
|
for(int i = 0; i < defenders.length; i++) {
|
||||||
|
if(defenders[i] == null || defenders[i].currentHP <= 0) {
|
||||||
|
defenders[i] = o;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -545,12 +545,7 @@ public class mapAwarenessAI {
|
|||||||
playerForceDirections[i].set(0,0,0);
|
playerForceDirections[i].set(0,0,0);
|
||||||
playerForceSize[i] = 0;
|
playerForceSize[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(numberOfPlayerUnitsOnMinimap < 5)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < playerUnitInMinimap.length; i++) {
|
for(int i = 0; i < playerUnitInMinimap.length; i++) {
|
||||||
if(playerUnitInMinimap[i] == null)
|
if(playerUnitInMinimap[i] == null)
|
||||||
continue;
|
continue;
|
||||||
|
@ -164,8 +164,17 @@ public class scoutingManagerAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(scout.type == 0)
|
if(scout.type == 0) {
|
||||||
|
if(mainThread.ec.theDefenseManagerAI.minorThreatLocation.x != 0 || mainThread.ec.theDefenseManagerAI.majorThreatLocation.x != 0) {
|
||||||
|
if(scout.currentHP > 0) {
|
||||||
|
mainThread.ec.theUnitProductionAI.addLightTank((lightTank)scout);
|
||||||
|
scout.moveTo(mainThread.ec.theUnitProductionAI.rallyPoint.x, mainThread.ec.theUnitProductionAI.rallyPoint.z);
|
||||||
|
scout.currentCommand = solidObject.attackMove;
|
||||||
|
scout.secondaryCommand = solidObject.attackMove;
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//try to avoid collision with player units
|
//try to avoid collision with player units
|
||||||
int xPos_old = scout.boundary2D.x1;
|
int xPos_old = scout.boundary2D.x1;
|
||||||
@ -221,9 +230,6 @@ public class scoutingManagerAI {
|
|||||||
scout.boundary2D.setOrigin(xPos_old, yPos_old);
|
scout.boundary2D.setOrigin(xPos_old, yPos_old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -304,9 +310,9 @@ public class scoutingManagerAI {
|
|||||||
|
|
||||||
//build light tank as scout when stealth tank tech is locked
|
//build light tank as scout when stealth tank tech is locked
|
||||||
public boolean needLightTank(){
|
public boolean needLightTank(){
|
||||||
//if((scout == null ) && !theBaseInfo.canBuildStealthTank){
|
if((scout == null ) && !theBaseInfo.canBuildStealthTank && mainThread.ec.theDefenseManagerAI.minorThreatLocation.x == 0 && mainThread.ec.theDefenseManagerAI.majorThreatLocation.x == 0){
|
||||||
// return true;
|
return true;
|
||||||
//}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -253,6 +253,7 @@ public class unitProductionAI {
|
|||||||
if(lightTanksControlledByCombatAI[i] == null || (lightTanksControlledByCombatAI[i] != null && lightTanksControlledByCombatAI[i].currentHP <=0)){
|
if(lightTanksControlledByCombatAI[i] == null || (lightTanksControlledByCombatAI[i] != null && lightTanksControlledByCombatAI[i].currentHP <=0)){
|
||||||
lightTanksControlledByCombatAI[i] = o;
|
lightTanksControlledByCombatAI[i] = o;
|
||||||
unitProduced++;
|
unitProduced++;
|
||||||
|
mainThread.ec.theDefenseManagerAI.addUnitToDefenders(o);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,6 +294,7 @@ public class unitProductionAI {
|
|||||||
if(stealthTanksControlledByCombatAI[i] == null || (stealthTanksControlledByCombatAI[i] != null && stealthTanksControlledByCombatAI[i].currentHP <=0)){
|
if(stealthTanksControlledByCombatAI[i] == null || (stealthTanksControlledByCombatAI[i] != null && stealthTanksControlledByCombatAI[i].currentHP <=0)){
|
||||||
stealthTanksControlledByCombatAI[i] = o;
|
stealthTanksControlledByCombatAI[i] = o;
|
||||||
unitProduced++;
|
unitProduced++;
|
||||||
|
mainThread.ec.theDefenseManagerAI.addUnitToDefenders(o);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user