| 709 | } |
| 710 | |
| 711 | void OnStep() override { |
| 712 | const ObservationInterface* obs = agent_->Observation(); |
| 713 | ActionInterface* act = agent_->Actions(); |
| 714 | if (!hatchery_spawned_) { |
| 715 | agent_->Debug()->DebugCreateUnit(UNIT_TYPEID::ZERG_HATCHERY, target_point_, agent_->Observation()->GetPlayerID() + 1, 1); |
| 716 | agent_->Debug()->SendDebug(); |
| 717 | hatchery_spawned_ = true; |
| 718 | } |
| 719 | |
| 720 | if (obs->GetGameLoop() < order_on_game_loop_) { |
| 721 | return; |
| 722 | } |
| 723 | |
| 724 | Units units = obs->GetUnits(); |
| 725 | |
| 726 | Unit test_unit; |
| 727 | for (const Unit& unit : units) { |
| 728 | if (unit.unit_type == test_unit_type_) { |
| 729 | test_unit_ = unit.tag; |
| 730 | test_unit = unit; |
| 731 | } |
| 732 | } |
| 733 | |
| 734 | for (const Unit& unit : units) { |
| 735 | if (unit.unit_type == UNIT_TYPEID::ZERG_HATCHERY) { |
| 736 | test_hatchery_ = unit; |
| 737 | } |
| 738 | } |
| 739 | |
| 740 | if (!verify_pre_scan_) { |
| 741 | if (units.size() != 1 || units.front().unit_type != UNIT_TYPEID::TERRAN_ORBITALCOMMAND) { |
| 742 | ReportError("Enemy structure is not initially hidden."); |
| 743 | } |
| 744 | if (test_unit.energy < 50.30 || test_unit.energy > 50.32) { |
| 745 | ReportError("Test pre-ability unit energy is not correct."); |
| 746 | } |
| 747 | verify_pre_scan_ = true; |
| 748 | } |
| 749 | |
| 750 | if (obs->GetGameLoop() < order_on_game_loop_ + 10) { |
| 751 | return; |
| 752 | } |
| 753 | |
| 754 | test_units_ = obs->GetUnits(Unit::Self, [&](const Unit& unit) { |
| 755 | return unit.unit_type == test_unit_type_; |
| 756 | }); |
| 757 | |
| 758 | if (test_units_.size() > 0) { |
| 759 | test_unit_ = test_units_.front(); |
| 760 | test_unit = test_units_.front(); |
| 761 | } |
| 762 | |
| 763 | IssueUnitCommand(act); |
| 764 | |
| 765 | if (obs->GetGameLoop() < order_on_game_loop_ + 15) { |
| 766 | return; |
| 767 | } |
| 768 |
nothing calls this directly
no test coverage detected