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

Class TestEffectScan

tests/test_unit_command.cc:687–800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685 //
686
687 class TestEffectScan : public TestUnitCommandTargetingPoint {
688 public:
689 Unit test_hatchery_;
690 bool hatchery_spawned_ = false;
691 bool verify_pre_scan_ = false;
692 bool verify_post_scan_ = false;
693
694 TestEffectScan() {
695 test_unit_type_ = UNIT_TYPEID::TERRAN_ORBITALCOMMAND;
696 test_ability_ = ABILITY_ID::EFFECT_SCAN;
697 instant_cast_ = true;
698 }
699
700 void SetTestTime() override {
701 wait_game_loops_ = 300;
702 }
703
704 void AdditionalTestSetup() override {
705 target_point_ = GetPointOffsetX(origin_pt_, 50);
706
707 agent_->Debug()->DebugShowMap();
708 agent_->Debug()->SendDebug();
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) {

Callers 1

UnitCommandTestBotMethod · 0.85

Calls

no outgoing calls

Tested by 1

UnitCommandTestBotMethod · 0.68