Search in sources :

Example 6 with Race

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);
    }
}
Also used : Race(bwapi.Race)

Example 7 with Race

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");
}
Also used : RaceUtils.createMockRace(BWJSAL.utils.RaceUtils.createMockRace) Race(bwapi.Race) Test(org.junit.Test)

Aggregations

Race (bwapi.Race)7 RaceUtils.createMockRace (BWJSAL.utils.RaceUtils.createMockRace)5 Test (org.junit.Test)5 UnitType (bwapi.UnitType)3 UnitTypeUtils.mockResourceDepotUnitType (BWJSAL.utils.UnitTypeUtils.mockResourceDepotUnitType)2 TilePosition (bwapi.TilePosition)2 Unit (bwapi.Unit)2 BaseLocation (bwta.BaseLocation)2