| 2095 | } |
| 2096 | |
| 2097 | bool TerranMultiplayerBot::TryBuildSCV() { |
| 2098 | const ObservationInterface* observation = Observation(); |
| 2099 | Units bases = observation->GetUnits(Unit::Alliance::Self, IsTownHall()); |
| 2100 | |
| 2101 | for (const auto& base : bases) { |
| 2102 | if (base.unit_type == UNIT_TYPEID::TERRAN_ORBITALCOMMAND && base.energy > 50) { |
| 2103 | Tag mineral; |
| 2104 | if (FindNearestMineralPatch(base.pos, mineral)) { |
| 2105 | Actions()->UnitCommand(base.tag, ABILITY_ID::EFFECT_CALLDOWNMULE, mineral); |
| 2106 | } |
| 2107 | } |
| 2108 | } |
| 2109 | |
| 2110 | if (observation->GetFoodWorkers() >= max_worker_count_) { |
| 2111 | return false; |
| 2112 | } |
| 2113 | |
| 2114 | if (observation->GetFoodUsed() >= observation->GetFoodCap()) { |
| 2115 | return false; |
| 2116 | } |
| 2117 | |
| 2118 | if (observation->GetFoodWorkers() > GetExpectedWorkers(UNIT_TYPEID::TERRAN_REFINERY)) { |
| 2119 | return false; |
| 2120 | } |
| 2121 | |
| 2122 | for (const auto& base : bases) { |
| 2123 | //if there is a base with less than ideal workers |
| 2124 | if (base.assigned_harvesters < base.ideal_harvesters && base.build_progress == 1) { |
| 2125 | if (observation->GetMinerals() >= 50) { |
| 2126 | return TryBuildUnit(ABILITY_ID::TRAIN_SCV, base.unit_type); |
| 2127 | } |
| 2128 | } |
| 2129 | } |
| 2130 | return false; |
| 2131 | } |
| 2132 | |
| 2133 | bool TerranMultiplayerBot::TryBuildSupplyDepot() { |
| 2134 | const ObservationInterface* observation = Observation(); |
nothing calls this directly
no test coverage detected