Skip to content

Commit

Permalink
Update Jbot.java
Browse files Browse the repository at this point in the history
  • Loading branch information
impie66 authored Oct 4, 2018
1 parent 7389271 commit a8a796c
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions src/jBot/Jbot.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ public void onStart() {
}

public void onUnitCreate(Unit unit) {
try{
boolean isMilitray = IsMilitrayUnit(unit);


Expand Down Expand Up @@ -611,6 +612,12 @@ public void onUnitCreate(Unit unit) {
if (unit.getType() == UnitType.Terran_Science_Vessel && unit.getPlayer() == self) {
TSF = TSF + 1;
}

}
catch(Exception e){
e.printStackTrace();
}


}

Expand Down Expand Up @@ -886,7 +893,7 @@ public void onUnitComplete(Unit unit) {
}

public void onUnitDestroy(Unit unit) {

try {
if(enemyWorkers.contains(unit) == true){
enemyWorkers.remove(unit);
}
Expand Down Expand Up @@ -1190,12 +1197,17 @@ public void onUnitDestroy(Unit unit) {
}

}



}
catch(Exception e){
e.printStackTrace();
}

}

public void onUnitDiscover(Unit unit) {

try {
boolean ismil = IsMilitrayUnit(unit);
//System.out.println("Is hostile? " + unit.getPlayer().isEnemy(self));
//System.out.println("Is Mil" + ismil + " Unit: " + unit.getType().toString());
Expand Down Expand Up @@ -1290,7 +1302,10 @@ public void onUnitDiscover(Unit unit) {
enemyRace = 2;
}


}
catch(Exception e){
e.printStackTrace();
}


}
Expand All @@ -1317,7 +1332,7 @@ public void onNukeDetect(Position target){


public void onUnitShow(Unit unit){

try {
if(estimatedEnemyScore > fapMyScores){
UpdateStrats();
}
Expand Down Expand Up @@ -1385,6 +1400,9 @@ public void onUnitShow(Unit unit){
pPosition.add(self.getStartLocation());
}

} catch(Exception e){
e.printStackTrace();
}
//end of onUnitShow

}
Expand Down Expand Up @@ -3909,13 +3927,13 @@ public boolean IsMilitrayUnit(Unit unit) {
System.out.println("Unit is Null");
}
else {
int Damage = unit.getType().groundWeapon().damageAmount() + unit.getType().airWeapon().damageAmount();
if(Damage > 0 && unit.getType().isWorker() == false && unit.getType().isBuilding() == false && unit.getType().isSpell() == false){
return true;
}
int Damage = unit.getType().groundWeapon().damageAmount() + unit.getType().airWeapon().damageAmount();
if(Damage > 0 && unit.getType().isWorker() == false && unit.getType().isBuilding() == false && unit.getType().isSpell() == false){
return true;
}
return false;
}
return false;
return false;
}

public boolean IsMilitrayBuilding(Unit unit) {
Expand Down Expand Up @@ -5468,14 +5486,22 @@ public boolean jFapGlobal(){
simulator.clear();

for(Unit unit : myUnits){
if(unit.getType() == UnitType.Unknown){
System.out.println("Unit: " + unit.getType().toString() + " DS: " + unit.getType().destroyScore());
}
simulator.addUnitPlayer1(new JFAPUnit(unit));
}

for(Unit unit : enemyUnits){
if(unit.getType() == UnitType.Unknown){
System.out.println("Unit: " + unit.getType().toString() + " DS: " + unit.getType().destroyScore());
}
System.out.println("Unit: " + unit.getType().toString() + " DS: " + unit.getType().destroyScore());
simulator.addUnitPlayer2(new JFAPUnit(unit));
}

for(Unit unit : enemyDefences){
System.out.println("Unit: " + unit.getType().toString() + " DS: " + unit.getType().destroyScore());
simulator.addUnitPlayer2(new JFAPUnit(unit));
}

Expand Down

0 comments on commit a8a796c

Please sign in to comment.