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
|
//build an additional refinery if there are more production building
|
||||||
//don't build more than 2 refinery around a goldmine
|
//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);
|
addBuildingToQueue(102);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import core.vector;
|
|||||||
import entity.constructionYard;
|
import entity.constructionYard;
|
||||||
import entity.goldMine;
|
import entity.goldMine;
|
||||||
import entity.harvester;
|
import entity.harvester;
|
||||||
|
import entity.refinery;
|
||||||
|
|
||||||
public class economyManagerAI {
|
public class economyManagerAI {
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ public class economyManagerAI {
|
|||||||
|
|
||||||
public int numberOfharvesters;
|
public int numberOfharvesters;
|
||||||
public vector evadeDirection;
|
public vector evadeDirection;
|
||||||
|
public int numberOfFunctionalRefinery;
|
||||||
|
|
||||||
public economyManagerAI(baseInfo theBaseInfo){
|
public economyManagerAI(baseInfo theBaseInfo){
|
||||||
this.theBaseInfo = theBaseInfo;
|
this.theBaseInfo = theBaseInfo;
|
||||||
@ -26,6 +27,19 @@ public class economyManagerAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processAI(){
|
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
|
//find an ideal goldmine
|
||||||
goldMine[] goldMines = mainThread.theAssetManager.goldMines;
|
goldMine[] goldMines = mainThread.theAssetManager.goldMines;
|
||||||
constructionYard[] constructionYards = mainThread.theAssetManager.constructionYards;
|
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){
|
if(mainThread.ec.theBuildingManagerAI.theBaseInfo.numberOfTechCenter > 0){
|
||||||
|
@ -853,7 +853,7 @@ public class lightTank extends solidObject{
|
|||||||
for(int j = 0; j < 4; j++){
|
for(int j = 0; j < 4; j++){
|
||||||
if(tile[j] != null){
|
if(tile[j] != null){
|
||||||
if(tile[j].teamNo != teamNo && tile[j].teamNo != -1 && tile[j].currentHP > 0 && !tile[j].isCloaked){
|
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]);
|
attack(tile[j]);
|
||||||
currentCommand = attackInNumbers;
|
currentCommand = attackInNumbers;
|
||||||
return;
|
return;
|
||||||
|
@ -1113,7 +1113,7 @@ public class stealthTank extends solidObject{
|
|||||||
for(int j = 0; j < 4; j++){
|
for(int j = 0; j < 4; j++){
|
||||||
if(tile[j] != null){
|
if(tile[j] != null){
|
||||||
if(tile[j].teamNo != teamNo && tile[j].teamNo != -1 && tile[j].currentHP > 0 && !tile[j].isCloaked){
|
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]);
|
attack(tile[j]);
|
||||||
currentCommand = attackInNumbers;
|
currentCommand = attackInNumbers;
|
||||||
return;
|
return;
|
||||||
|
@ -100,7 +100,6 @@ public class bullet {
|
|||||||
public void updateAndDraw(){
|
public void updateAndDraw(){
|
||||||
if(!isInAction)
|
if(!isInAction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
distanceToTarget -= speed;
|
distanceToTarget -= speed;
|
||||||
if(distanceToTarget < 0){
|
if(distanceToTarget < 0){
|
||||||
@ -118,6 +117,7 @@ public class bullet {
|
|||||||
int start = xPos/16 + (127 - yPos/16)*128;
|
int start = xPos/16 + (127 - yPos/16)*128;
|
||||||
int targetTeamNo = target.teamNo;
|
int targetTeamNo = target.teamNo;
|
||||||
solidObject[] tile;
|
solidObject[] tile;
|
||||||
|
solidObject o;
|
||||||
|
|
||||||
for(int i = 0; i < 9; i++){
|
for(int i = 0; i < 9; i++){
|
||||||
int index = start + tiles3x3[i];
|
int index = start + tiles3x3[i];
|
||||||
@ -125,12 +125,17 @@ public class bullet {
|
|||||||
continue;
|
continue;
|
||||||
tile = mainThread.gridMap.tiles[index];
|
tile = mainThread.gridMap.tiles[index];
|
||||||
for(int j = 0; j < 4; j++){
|
for(int j = 0; j < 4; j++){
|
||||||
if(tile[j] != null){
|
o = tile[j];
|
||||||
if(tile[j].teamNo == targetTeamNo && tile[j].teamNo!= attacker.teamNo && tile[j].attackStatus != solidObject.isAttacking && tile[j].currentCommand != solidObject.move && tile[j].isCloaked == false
|
if(o != null){
|
||||||
&& previousUnderAttackCountDown <=30 && (tile[j].currentCommand == solidObject.StandBy || tile[j].secondaryCommand == solidObject.attackMove)){
|
if(o.teamNo == targetTeamNo
|
||||||
if(tile[j].type < 100){
|
&& o.teamNo!= attacker.teamNo
|
||||||
tile[j].attack(attacker);
|
&& (o.attackStatus != solidObject.isAttacking || (o.attackStatus == solidObject.isAttacking && o.secondaryCommand == solidObject.attackMove && (o.targetObject == null || o.targetObject.type > 100) ))
|
||||||
tile[j].currentCommand = solidObject.attackCautiously;
|
&& 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