| 2542 | } |
| 2543 | |
| 2544 | bool TerranMultiplayerBot::TryBuildStructureRandom(AbilityID ability_type_for_structure, UnitTypeID unit_type) { |
| 2545 | float rx = GetRandomScalar(); |
| 2546 | float ry = GetRandomScalar(); |
| 2547 | Point2D build_location = Point2D(staging_location_.x + rx * 15, staging_location_.y + ry * 15); |
| 2548 | |
| 2549 | Units units = Observation()->GetUnits(Unit::Self, IsStructure(Observation())); |
| 2550 | float distance = std::numeric_limits<float>::max(); |
| 2551 | for (const auto& u : units) { |
| 2552 | if (u.unit_type == UNIT_TYPEID::TERRAN_SUPPLYDEPOTLOWERED) { |
| 2553 | continue; |
| 2554 | } |
| 2555 | float d = Distance2D(u.pos, build_location); |
| 2556 | if (d < distance) { |
| 2557 | distance = d; |
| 2558 | } |
| 2559 | } |
| 2560 | if (distance < 6) { |
| 2561 | return false; |
| 2562 | } |
| 2563 | return TryBuildStructure(ability_type_for_structure, unit_type, build_location); |
| 2564 | } |
| 2565 | |
| 2566 | void TerranMultiplayerBot::ManageUpgrades() { |
| 2567 | const ObservationInterface* observation = Observation(); |
nothing calls this directly
no test coverage detected