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

Method BuildExtractor

examples/common/bot_examples.cc:2011–2029  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2009}
2010
2011bool ZergMultiplayerBot::BuildExtractor() {
2012 const ObservationInterface* observation = Observation();
2013 Units bases = observation->GetUnits(Unit::Alliance::Self, IsTownHall());
2014
2015 if (CountUnitType(observation, UNIT_TYPEID::ZERG_EXTRACTOR) >= observation->GetUnits(Unit::Alliance::Self, IsTownHall()).size() * 2) {
2016 return false;
2017 }
2018
2019 for (const auto& base : bases) {
2020 if (base.assigned_harvesters >= base.ideal_harvesters) {
2021 if (base.build_progress == 1) {
2022 if (TryBuildGas(ABILITY_ID::BUILD_EXTRACTOR, UNIT_TYPEID::ZERG_DRONE, base.pos)) {
2023 return true;
2024 }
2025 }
2026 }
2027 }
2028 return false;
2029}
2030
2031void ZergMultiplayerBot::OnStep() {
2032

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