home commit
This commit is contained in:
parent
d2fd5da9eb
commit
c7e92c57ce
@ -117,7 +117,7 @@ public class buildingManagerAI {
|
||||
|
||||
//build an additional refinery if there are more production building
|
||||
//don't build more than 2 refinery around a goldmine
|
||||
if(getNumberOfFunctionalRefinery() < theBaseInfo.numberOfConstructionYard*2 && theBaseInfo.numberOfFactory > 0 && theBaseInfo.canBuildRefinery && getNumberOfRefineriesNearPreferedGoldMine() < 2){
|
||||
if(getNumberOfFunctionalRefinery() < theBaseInfo.numberOfConstructionYard*2 && (getNumberOfFunctionalRefinery() == 0 || theBaseInfo.numberOfFactory > 0) && theBaseInfo.canBuildRefinery && getNumberOfRefineriesNearPreferedGoldMine() < 2){
|
||||
addBuildingToQueue(102);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import core.vector;
|
||||
import entity.constructionYard;
|
||||
import entity.goldMine;
|
||||
import entity.harvester;
|
||||
import entity.refinery;
|
||||
|
||||
public class economyManagerAI {
|
||||
|
||||
@ -16,7 +17,7 @@ public class economyManagerAI {
|
||||
|
||||
public int numberOfharvesters;
|
||||
public vector evadeDirection;
|
||||
|
||||
public int numberOfFunctionalRefinery;
|
||||
|
||||
public economyManagerAI(baseInfo theBaseInfo){
|
||||
this.theBaseInfo = theBaseInfo;
|
||||
@ -26,6 +27,19 @@ public class economyManagerAI {
|
||||
}
|
||||
|
||||
public void processAI(){
|
||||
//find the number of functional refinery, (refinery with depleted gold mine are not considered functional)
|
||||
numberOfFunctionalRefinery = 0;
|
||||
refinery[] refineries = mainThread.theAssetManager.refineries;
|
||||
for(int i = 0; i < refineries.length; i++) {
|
||||
if(refineries[i] != null && refineries[i].teamNo == 1 && refineries[i].currentHP> 0) {
|
||||
if(refineries[i].nearestGoldMine != null && refineries[i].nearestGoldMine.goldDeposite > 0)
|
||||
numberOfFunctionalRefinery++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//find an ideal goldmine
|
||||
goldMine[] goldMines = mainThread.theAssetManager.goldMines;
|
||||
constructionYard[] constructionYards = mainThread.theAssetManager.constructionYards;
|
||||
|
@ -191,6 +191,15 @@ public class unitProductionAI {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mainThread.ec.theEconomyManagerAI.numberOfharvesters > 6 && theBaseInfo.currentCredit > 1500) {
|
||||
if(!communicationCenter.harvesterSpeedResearched_enemy) {
|
||||
if(communicationCenter.harvesterSpeedResearchProgress_enemy == 255){
|
||||
communicationCenter.researchHarvesterSpeed(1);
|
||||
System.out.println("----------------------------AI starts researching harvester speed ability------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mainThread.ec.theBuildingManagerAI.theBaseInfo.numberOfTechCenter > 0){
|
||||
|
@ -853,7 +853,7 @@ public class lightTank extends solidObject{
|
||||
for(int j = 0; j < 4; j++){
|
||||
if(tile[j] != null){
|
||||
if(tile[j].teamNo != teamNo && tile[j].teamNo != -1 && tile[j].currentHP > 0 && !tile[j].isCloaked){
|
||||
if(tile[j].type < 100){
|
||||
if(tile[j].type < 100 || tile[j].type >= 199){
|
||||
attack(tile[j]);
|
||||
currentCommand = attackInNumbers;
|
||||
return;
|
||||
|
@ -1113,7 +1113,7 @@ public class stealthTank extends solidObject{
|
||||
for(int j = 0; j < 4; j++){
|
||||
if(tile[j] != null){
|
||||
if(tile[j].teamNo != teamNo && tile[j].teamNo != -1 && tile[j].currentHP > 0 && !tile[j].isCloaked){
|
||||
if(tile[j].type < 100){
|
||||
if(tile[j].type < 100 || tile[j].type >= 199){
|
||||
attack(tile[j]);
|
||||
currentCommand = attackInNumbers;
|
||||
return;
|
||||
|
@ -100,7 +100,6 @@ public class bullet {
|
||||
public void updateAndDraw(){
|
||||
if(!isInAction)
|
||||
return;
|
||||
|
||||
|
||||
distanceToTarget -= speed;
|
||||
if(distanceToTarget < 0){
|
||||
@ -118,6 +117,7 @@ public class bullet {
|
||||
int start = xPos/16 + (127 - yPos/16)*128;
|
||||
int targetTeamNo = target.teamNo;
|
||||
solidObject[] tile;
|
||||
solidObject o;
|
||||
|
||||
for(int i = 0; i < 9; i++){
|
||||
int index = start + tiles3x3[i];
|
||||
@ -125,12 +125,17 @@ public class bullet {
|
||||
continue;
|
||||
tile = mainThread.gridMap.tiles[index];
|
||||
for(int j = 0; j < 4; j++){
|
||||
if(tile[j] != null){
|
||||
if(tile[j].teamNo == targetTeamNo && tile[j].teamNo!= attacker.teamNo && tile[j].attackStatus != solidObject.isAttacking && tile[j].currentCommand != solidObject.move && tile[j].isCloaked == false
|
||||
&& previousUnderAttackCountDown <=30 && (tile[j].currentCommand == solidObject.StandBy || tile[j].secondaryCommand == solidObject.attackMove)){
|
||||
if(tile[j].type < 100){
|
||||
tile[j].attack(attacker);
|
||||
tile[j].currentCommand = solidObject.attackCautiously;
|
||||
o = tile[j];
|
||||
if(o != null){
|
||||
if(o.teamNo == targetTeamNo
|
||||
&& o.teamNo!= attacker.teamNo
|
||||
&& (o.attackStatus != solidObject.isAttacking || (o.attackStatus == solidObject.isAttacking && o.secondaryCommand == solidObject.attackMove && (o.targetObject == null || o.targetObject.type > 100) ))
|
||||
&& o.currentCommand != solidObject.move && o.isCloaked == false
|
||||
&& previousUnderAttackCountDown <=30
|
||||
&& (o.currentCommand == solidObject.StandBy || o.secondaryCommand == solidObject.attackMove)){
|
||||
if(o.type < 100){
|
||||
o.attack(attacker);
|
||||
o.currentCommand = solidObject.attackCautiously;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user