MCPcopy Create free account
hub / github.com/Blizzard/s2client-api / BuildRefinery

Method BuildRefinery

examples/common/bot_examples.cc:2910–2928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2908}
2909
2910bool TerranMultiplayerBot::BuildRefinery() {
2911 const ObservationInterface* observation = Observation();
2912 Units bases = observation->GetUnits(Unit::Alliance::Self, IsTownHall());
2913
2914 if (CountUnitType(observation, UNIT_TYPEID::TERRAN_REFINERY) >= observation->GetUnits(Unit::Alliance::Self, IsTownHall()).size() * 2) {
2915 return false;
2916 }
2917
2918 for (const auto& base : bases) {
2919 if (base.assigned_harvesters >= base.ideal_harvesters) {
2920 if (base.build_progress == 1) {
2921 if (TryBuildGas(ABILITY_ID::BUILD_REFINERY, UNIT_TYPEID::TERRAN_SCV, base.pos)) {
2922 return true;
2923 }
2924 }
2925 }
2926 }
2927 return false;
2928}
2929void TerranMultiplayerBot::OnStep() {
2930
2931

Callers

nothing calls this directly

Calls 4

ObservationClass · 0.85
IsTownHallClass · 0.85
CountUnitTypeFunction · 0.85
GetUnitsMethod · 0.80

Tested by

no test coverage detected