home commit

This commit is contained in:
Pan 2019-01-27 00:06:48 +13:00
parent 45ce141ab3
commit 4f7f64d80d
5 changed files with 31 additions and 3 deletions

View File

@ -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++){
//lightTank l = new lightTank(new vector(i*0.25f+ 1.125f,-0.3f, 17.375f - 0.25f*j), 90, 0); stealthTank l = new stealthTank(new vector(i*0.25f+ 1.125f,-0.3f, 17.375f - 0.25f*j), 90, 0);
//addLightTank(l); addStealthTank(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);

View File

@ -69,6 +69,7 @@ public class baseExpensionAI {
expensionGoldMine = goldMines[expensionPiorityList[targetExpension]]; expensionGoldMine = goldMines[expensionPiorityList[targetExpension]];
//produce a total of 3 scout units, check if there are any stealth tank in the production //produce a total of 3 scout units, check if there are any stealth tank in the production
numberOfActiveScout = 0; numberOfActiveScout = 0;
numberOfStealthTankScout = 0; numberOfStealthTankScout = 0;
@ -159,6 +160,11 @@ public class baseExpensionAI {
//move mcv to the next expension location //move mcv to the next expension location
if(myMCV != null){ if(myMCV != null){
if(frameAI > 400 && frameAI < 550) {
mainThread.ec.theUnitProductionAI.rallyPoint.set(expensionGoldMine.centre.x, 0, expensionGoldMine.centre.z - 1.5f);
}
isExpanding = true; isExpanding = true;
if(myMCV.getDistance(expensionGoldMine) > 2 && !(myMCV.destinationX == expensionGoldMine.centre.x && myMCV.destinationY == expensionGoldMine.centre.z)){ if(myMCV.getDistance(expensionGoldMine) > 2 && !(myMCV.destinationX == expensionGoldMine.centre.x && myMCV.destinationY == expensionGoldMine.centre.z)){
myMCV.moveTo(expensionGoldMine.centre.x, expensionGoldMine.centre.z); myMCV.moveTo(expensionGoldMine.centre.x, expensionGoldMine.centre.z);

View File

@ -54,6 +54,8 @@ public class combatManagerAI {
public boolean staticDefenseAhead; public boolean staticDefenseAhead;
public boolean dealWithMajorThreat;
public combatManagerAI(baseInfo theBaseInfo){ public combatManagerAI(baseInfo theBaseInfo){
this.theBaseInfo = theBaseInfo; this.theBaseInfo = theBaseInfo;
@ -238,6 +240,24 @@ public class combatManagerAI {
} }
}else if(currentState == aggressing){ }else if(currentState == aggressing){
//check if a major threat is found other than the current attack position
if(mainThread.ec.theDefenseManagerAI.majorThreatLocation.x != 0){
float xPos = mainThread.ec.theDefenseManagerAI.majorThreatLocation.x;
float zPos = mainThread.ec.theDefenseManagerAI.majorThreatLocation.z;
float d1 = (attackPosition.x - combatCenterX)*(attackPosition.x - combatCenterX) + (attackPosition.z - combatCenterZ)*(attackPosition.z - combatCenterZ);
float d2 = (xPos - combatCenterX)*(xPos - combatCenterX) + (zPos - combatCenterZ)*(zPos - combatCenterZ);
if(d2 <= d1) {
attackPosition.set(xPos, 0, zPos);
}
dealWithMajorThreat = true;
}else {
if(dealWithMajorThreat == true) {
currentState = booming;
dealWithMajorThreat = false;
return;
}
}
attackDirection.set(attackPosition.x - combatCenterX, 0, attackPosition.z - combatCenterZ); attackDirection.set(attackPosition.x - combatCenterX, 0, attackPosition.z - combatCenterZ);
distanceToTarget = attackDirection.getLength(); distanceToTarget = attackDirection.getLength();

View File

@ -167,11 +167,13 @@ public class defenseManagerAI {
//if the size of player unit cluster is bigger or equal to 5 then check if the threat is a big one //if the size of player unit cluster is bigger or equal to 5 then check if the threat is a big one
if(playerForceIsNearBase(mainPlayerForceLocation)) { if(playerForceIsNearBase(mainPlayerForceLocation)) {
giveBackControlOfDefendersToCombatAI(); giveBackControlOfDefendersToCombatAI();
majorThreatCooldown = 20;
majorThreatLocation.set(mainPlayerForceLocation); majorThreatLocation.set(mainPlayerForceLocation);
}else { }else {
float d = playerForceIsMovingTwoardsBase(mainPlayerForceLocation, mainPlayerForceDirection); float d = playerForceIsMovingTwoardsBase(mainPlayerForceLocation, mainPlayerForceDirection);
if(d != -1) { if(d != -1) {
giveBackControlOfDefendersToCombatAI(); giveBackControlOfDefendersToCombatAI();
majorThreatCooldown = 20;
majorThreatLocation.set(mainPlayerForceLocation); majorThreatLocation.set(mainPlayerForceLocation);
majorThreatLocation.add(mainPlayerForceDirection, d); majorThreatLocation.add(mainPlayerForceDirection, d);
} }

View File

@ -84,7 +84,7 @@ public class enemyCommander {
public void thinkHardLikeHumanPlayer(){ public void thinkHardLikeHumanPlayer(){
//the order is important!!
if(mainThread.frameIndex % 30 == 0){ if(mainThread.frameIndex % 30 == 0){
theMapAwarenessAI.processAI(); theMapAwarenessAI.processAI();
} }