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

Class TestSensorTower

tests/test_unit_command.cc:1247–1286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1245 //
1246
1247 class TestSensorTower : public TestUnitCommand {
1248 public:
1249 TestSensorTower() {
1250 test_unit_type_ = UNIT_TYPEID::TERRAN_SENSORTOWER;
1251 }
1252
1253 void SetTestTime() override {
1254 wait_game_loops_ = 50;
1255 }
1256
1257 void AdditionalTestSetup() override {
1258 agent_->Debug()->DebugCreateUnit(UNIT_TYPEID::ZERG_MUTALISK, GetPointOffsetX(origin_pt_, 25), agent_->Observation()->GetPlayerID() + 1, 1);
1259 agent_->Debug()->DebugShowMap();
1260 agent_->Debug()->SendDebug();
1261 }
1262
1263 void OnStep() override {}
1264
1265 void OnTestFinish() override {
1266 const ObservationInterface* obs = agent_->Observation();
1267 const Units& target_units = obs->GetUnits(Unit::Alliance::Enemy);
1268
1269 if (target_units.front().is_blip != true) {
1270 ReportError("Target unit is not a blip.");
1271 }
1272 if (target_units.front().cloak != Unit::CloakState::Unknown) {
1273 ReportError("Target unit cloak state is incorrect.");
1274 }
1275 if (target_units.front().display_type != Unit::DisplayType::Hidden) {
1276 ReportError("Target unit is not hidden.");
1277 }
1278 if (target_units.front().owner != 0) {
1279 ReportError("Owner of unit is incorrect.");
1280 }
1281
1282 KillAllUnits();
1283 agent_->Debug()->DebugShowMap();
1284 agent_->Debug()->SendDebug();
1285 }
1286 };
1287
1288
1289 //

Callers 1

UnitCommandTestBotMethod · 0.85

Calls

no outgoing calls

Tested by 1

UnitCommandTestBotMethod · 0.68