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

Class TestTrainRoach

tests/test_unit_command.cc:1517–1563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1515 //
1516
1517 class TestTrainRoach : public TestUnitCommandNoTarget {
1518 public:
1519 TestTrainRoach() {
1520 test_unit_type_ = UNIT_TYPEID::ZERG_HATCHERY;
1521 test_ability_ = ABILITY_ID::TRAIN_ROACH;
1522 }
1523
1524 void SetTestTime() override {
1525 wait_game_loops_ = 150;
1526 }
1527
1528 void SetOriginPoint() override {
1529 const GameInfo& game_info = agent_->Observation()->GetGameInfo();
1530 origin_pt_ = GetPointOffsetX(FindCenterOfMap(game_info), -10);
1531 }
1532
1533 void AdditionalTestSetup() override {
1534 order_on_game_loop_ += 30;
1535 test_unit_type_ = UNIT_TYPEID::ZERG_LARVA;
1536 }
1537
1538 void IssueUnitCommand(ActionInterface* act) override {
1539 if (ability_command_sent_) {
1540 return;
1541 }
1542
1543 act->UnitCommand(test_unit_, test_ability_);
1544 act->UnitCommand(test_unit_, test_ability_);
1545 act->UnitCommand(test_unit_, test_ability_);
1546 ability_command_sent_ = true;
1547 }
1548
1549 void OnTestFinish() override {
1550 const ObservationInterface* obs = agent_->Observation();
1551 Units roaches = obs->GetUnits(Unit::Self, [&](const Unit& unit) {
1552 return unit.unit_type == test_unit_type_;
1553 });
1554
1555 if (roaches.size() != 3) {
1556 ReportError("The number of units trained was not correct.");
1557 }
1558
1559 VerifyUnitExistsAndComplete(UNIT_TYPEID::ZERG_ROACH);
1560 VerifyUnitIdleAfterOrder(UNIT_TYPEID::ZERG_ROACH);
1561 KillAllUnits();
1562 }
1563 };
1564
1565
1566 //

Callers 1

UnitCommandTestBotMethod · 0.85

Calls

no outgoing calls

Tested by 1

UnitCommandTestBotMethod · 0.68