use of bwapi.Race in project BWJSAL by RobinsonMann.
the class BuildTimeTracker method buildTimesForStartingUnits.
/**
* At the start of every game, based off of the enemies race, we know the build times for certain
* units / items.
*/
private void buildTimesForStartingUnits() {
final Race enemyRace = this.game.enemy().getRace();
// Regardless of race, enemy will start with workers and command center
updateBuildTime(enemyRace.getCenter(), 0);
updateBuildTime(enemyRace.getWorker(), 0);
// We know some additional
if (enemyRace == Race.Zerg) {
updateBuildTime(UnitType.Zerg_Overlord, 0);
updateBuildTime(UnitType.Zerg_Larva, 0);
}
}
use of bwapi.Race in project BWJSAL by RobinsonMann.
the class BuildTimeTrackerTest method getBuildTime_onStart_startingUnitsBuildTimeOf0.
@Test
public void getBuildTime_onStart_startingUnitsBuildTimeOf0() {
final Race mockZerg = createMockRace(UnitType.Zerg_Hatchery, UnitType.Zerg_Drone);
setStaticFinalField(Race.class, "Zerg", mockZerg);
when(this.mockEnemy.getRace()).thenReturn(Race.Zerg);
this.target.onStart();
assertEnemyHasBuilt(UnitType.Zerg_Overlord, "Zerg starts with overlord");
assertEnemyHasBuilt(UnitType.Zerg_Larva, "Zerg starts with larva");
}
Aggregations