h
This commit is contained in:
parent
3d29261deb
commit
b94af05a04
@ -70,7 +70,7 @@ public class combatManagerAI {
|
|||||||
this.theBaseInfo = mainThread.ec.theBaseInfo;
|
this.theBaseInfo = mainThread.ec.theBaseInfo;
|
||||||
|
|
||||||
standardAttackTime = 500;
|
standardAttackTime = 500;
|
||||||
rushAttackTime = 250 + gameData.getRandom()/4;
|
rushAttackTime = 250 + gameData.getRandom()/5;
|
||||||
|
|
||||||
goldMines = mainThread.theAssetManager.goldMines;
|
goldMines = mainThread.theAssetManager.goldMines;
|
||||||
|
|
||||||
|
@ -128,10 +128,10 @@ public class defenseManagerAI {
|
|||||||
//if there is no player units in sight, return to patrol position
|
//if there is no player units in sight, return to patrol position
|
||||||
if(i == 0) {
|
if(i == 0) {
|
||||||
if(frameAI%28 < 14) {
|
if(frameAI%28 < 14) {
|
||||||
xPos = 20f;
|
xPos = 15.5f;
|
||||||
zPos = 30.5f;
|
zPos = 30.5f;
|
||||||
}else {
|
}else {
|
||||||
xPos = 20f;
|
xPos = 15.5f;
|
||||||
zPos = 24.5f;
|
zPos = 24.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,12 +149,12 @@ public class defenseManagerAI {
|
|||||||
|
|
||||||
if(i == 1) {
|
if(i == 1) {
|
||||||
|
|
||||||
if(frameAI%20 < 10) {
|
if(frameAI%30 < 15) {
|
||||||
xPos = 30f;
|
xPos = 29.25f;
|
||||||
zPos = 15f;
|
zPos = 17f;
|
||||||
}else {
|
}else {
|
||||||
xPos = 26f;
|
xPos = 29.25f;
|
||||||
zPos = 15f;
|
zPos = 10f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(frameAI > 1000) {
|
if(frameAI > 1000) {
|
||||||
@ -535,7 +535,7 @@ public class defenseManagerAI {
|
|||||||
threatToBaseDirection.unit();
|
threatToBaseDirection.unit();
|
||||||
if(threatToBaseDirection.dot(direction) > 0.8) {
|
if(threatToBaseDirection.dot(direction) > 0.8) {
|
||||||
|
|
||||||
float currentThreatDistance = Math.max(3f, d - 2f);
|
float currentThreatDistance = Math.max(3f, d);
|
||||||
|
|
||||||
if(currentThreatDistance < threatDistance)
|
if(currentThreatDistance < threatDistance)
|
||||||
threatDistance = currentThreatDistance;
|
threatDistance = currentThreatDistance;
|
||||||
|
@ -6,6 +6,9 @@ package enemyAI;
|
|||||||
|
|
||||||
import core.baseInfo;
|
import core.baseInfo;
|
||||||
import core.mainThread;
|
import core.mainThread;
|
||||||
|
import entity.rocketTank;
|
||||||
|
import entity.solidObject;
|
||||||
|
import entity.stealthTank;
|
||||||
|
|
||||||
public class harassmentAI {
|
public class harassmentAI {
|
||||||
|
|
||||||
@ -14,12 +17,21 @@ public class harassmentAI {
|
|||||||
|
|
||||||
public int frameAI;
|
public int frameAI;
|
||||||
public int miniFrameAI;
|
public int miniFrameAI;
|
||||||
|
public stealthTank scout;
|
||||||
|
public rocketTank[] squad;
|
||||||
|
public int status;
|
||||||
|
public final int gathering = 0;
|
||||||
|
public final int positioning = 1;
|
||||||
|
public final int harasing = 2;
|
||||||
|
public final int retreating = 3;
|
||||||
|
public stealthTank[] stealthTanksControlledByCombatAI;
|
||||||
|
public rocketTank[] rocketTanksControlledByCombatAI;
|
||||||
|
|
||||||
|
|
||||||
public harassmentAI(){
|
public harassmentAI(){
|
||||||
this.theBaseInfo = mainThread.ec.theBaseInfo;
|
this.theBaseInfo = mainThread.ec.theBaseInfo;
|
||||||
|
squad = new rocketTank[3];
|
||||||
|
status = gathering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processAI(){
|
public void processAI(){
|
||||||
@ -27,10 +39,121 @@ public class harassmentAI {
|
|||||||
frameAI = mainThread.ec.frameAI;
|
frameAI = mainThread.ec.frameAI;
|
||||||
|
|
||||||
if(miniFrameAI%30 == 29) {
|
if(miniFrameAI%30 == 29) {
|
||||||
|
System.out.println(frameAI + " " + mainThread.ec.theUnitProductionAI.numberOfRocketTanksControlledByCombatAI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//only activate this AI after 660 game seconds (about 9 minutes in real time)
|
||||||
|
if(frameAI < 660)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stealthTanksControlledByCombatAI = mainThread.ec.theUnitProductionAI.stealthTanksControlledByCombatAI;
|
||||||
|
rocketTanksControlledByCombatAI = mainThread.ec.theUnitProductionAI.rocketTanksControlledByCombatAI;
|
||||||
|
|
||||||
|
if(status == gathering) {
|
||||||
|
|
||||||
|
if(scout == null || scout.currentHP <=0) {
|
||||||
|
for(int i = 0; i < stealthTanksControlledByCombatAI.length; i++) {
|
||||||
|
if(stealthTanksControlledByCombatAI[i] != null && stealthTanksControlledByCombatAI[i].currentHP == stealthTank.maxHP && stealthTanksControlledByCombatAI[i].attackStatus != solidObject.isAttacking) {
|
||||||
|
if(hasRoomToMove(stealthTanksControlledByCombatAI[i])) {
|
||||||
|
scout = stealthTanksControlledByCombatAI[i];
|
||||||
|
stealthTanksControlledByCombatAI[i] = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(scout != null) {
|
||||||
|
scout.moveTo(mainThread.ec.theUnitProductionAI.rallyPoint.x - 1,mainThread.ec.theUnitProductionAI.rallyPoint.z);
|
||||||
|
scout.currentCommand = solidObject.move;
|
||||||
|
scout.secondaryCommand = solidObject.StandBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < squad.length; i++) {
|
||||||
|
if(squad[i] == null || squad[i].currentHP <=0) {
|
||||||
|
for(int j = 0; j < rocketTanksControlledByCombatAI.length; j++) {
|
||||||
|
if(rocketTanksControlledByCombatAI[j] != null && rocketTanksControlledByCombatAI[j].currentHP == rocketTank.maxHP && rocketTanksControlledByCombatAI[j].attackStatus != solidObject.isAttacking) {
|
||||||
|
if(hasRoomToMove(rocketTanksControlledByCombatAI[j])) {
|
||||||
|
squad[i] = rocketTanksControlledByCombatAI[j];
|
||||||
|
rocketTanksControlledByCombatAI[j] = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int numberOfSquad = 0;
|
||||||
|
for(int i = 0; i < squad.length; i++) {
|
||||||
|
if(squad[i] != null) {
|
||||||
|
squad[i].attackMoveTo(mainThread.ec.theUnitProductionAI.rallyPoint.x - 1,mainThread.ec.theUnitProductionAI.rallyPoint.z);
|
||||||
|
squad[i].currentCommand = solidObject.attackMove;
|
||||||
|
squad[i].secondaryCommand = solidObject.attackMove;
|
||||||
|
numberOfSquad++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(numberOfSquad == squad.length && scout !=null) {
|
||||||
|
status = positioning;
|
||||||
|
}
|
||||||
|
}else if(status == positioning) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasRoomToMove(solidObject o) {
|
||||||
|
float x = o.centre.x;
|
||||||
|
float z = o.centre.x;
|
||||||
|
|
||||||
|
solidObject[] s1 = mainThread.gridMap.tiles[(int)((x+0.25)*4) + (127 - (int)(z*4))*128];
|
||||||
|
boolean hasRoomToMove = true;
|
||||||
|
for(int i = 0; i < s1.length; i++) {
|
||||||
|
if(s1[i] != null && s1[i] != o) {
|
||||||
|
hasRoomToMove = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasRoomToMove)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
solidObject[] s2 = mainThread.gridMap.tiles[(int)((x-0.25)*4) + (127 - (int)(z*4))*128];
|
||||||
|
hasRoomToMove = true;
|
||||||
|
for(int i = 0; i < s2.length; i++) {
|
||||||
|
if(s2[i] != null && s2[i] != o) {
|
||||||
|
hasRoomToMove = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasRoomToMove)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
solidObject[] s3 = mainThread.gridMap.tiles[(int)(x*4) + (127 - (int)((z + 0.25)*4))*128];
|
||||||
|
hasRoomToMove = true;
|
||||||
|
for(int i = 0; i < s3.length; i++) {
|
||||||
|
if(s3[i] != null && s3[i] != o) {
|
||||||
|
hasRoomToMove = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasRoomToMove)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
solidObject[] s4 = mainThread.gridMap.tiles[(int)(x*4) + (127 - (int)((z - 0.25)*4))*128];
|
||||||
|
hasRoomToMove = true;
|
||||||
|
for(int i = 0; i < s4.length; i++) {
|
||||||
|
if(s4[i] != null && s4[i] != o) {
|
||||||
|
hasRoomToMove = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasRoomToMove)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -973,7 +973,7 @@ public class lightTank extends solidObject{
|
|||||||
int theDamage = myDamage;
|
int theDamage = myDamage;
|
||||||
if(targetObject.type == 7)
|
if(targetObject.type == 7)
|
||||||
theDamage*=1.5;
|
theDamage*=1.5;
|
||||||
if(targetObject.type == 0)
|
if(targetObject.type == 0 || targetObject.type == 1)
|
||||||
theDamage*=1.2;
|
theDamage*=1.2;
|
||||||
if(targetObject.type >= 100)
|
if(targetObject.type >= 100)
|
||||||
theDamage*=0.6;
|
theDamage*=0.6;
|
||||||
|
@ -50,8 +50,8 @@ public class MiniMap {
|
|||||||
drawBackground(screen, minimapBitmap);
|
drawBackground(screen, minimapBitmap);
|
||||||
|
|
||||||
//remove fog of war for testing
|
//remove fog of war for testing
|
||||||
//for(int i = 0; i < minimapBitmap.length; i++)
|
for(int i = 0; i < minimapBitmap.length; i++)
|
||||||
// minimapBitmap[i] = true;
|
minimapBitmap[i] = true;
|
||||||
|
|
||||||
//draw unit positions on minimap
|
//draw unit positions on minimap
|
||||||
drawUnit(screen, minimapBitmap, unitsForMiniMap, unitsForMiniMapCount);
|
drawUnit(screen, minimapBitmap, unitsForMiniMap, unitsForMiniMapCount);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user