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

Method TryBuildProbe

examples/common/bot_examples.cc:1208–1232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1206}
1207
1208bool ProtossMultiplayerBot::TryBuildProbe() {
1209 const ObservationInterface* observation = Observation();
1210 Units bases = observation->GetUnits(Unit::Alliance::Self, IsTownHall());
1211 if (observation->GetFoodWorkers() >= max_worker_count_) {
1212 return false;
1213 }
1214
1215 if (observation->GetFoodUsed() >= observation->GetFoodCap()) {
1216 return false;
1217 }
1218
1219 if (observation->GetFoodWorkers() > GetExpectedWorkers(UNIT_TYPEID::PROTOSS_ASSIMILATOR)) {
1220 return false;
1221 }
1222
1223 for (const auto& base : bases) {
1224 //if there is a base with less than ideal workers
1225 if (base.assigned_harvesters < base.ideal_harvesters && base.build_progress == 1) {
1226 if (observation->GetMinerals() >= 50) {
1227 return TryBuildUnit(ABILITY_ID::TRAIN_PROBE, UNIT_TYPEID::PROTOSS_NEXUS);
1228 }
1229 }
1230 }
1231 return false;
1232}
1233
1234void ProtossMultiplayerBot::OnStep() {
1235

Callers

nothing calls this directly

Calls 7

ObservationClass · 0.85
IsTownHallClass · 0.85
GetUnitsMethod · 0.80
GetFoodWorkersMethod · 0.80
GetFoodUsedMethod · 0.80
GetFoodCapMethod · 0.80
GetMineralsMethod · 0.80

Tested by

no test coverage detected