MCPcopy Create free account
hub / github.com/bwapi/bwapi / start

Method start

bwapi/TestAIModule/Source/CloakTest.cpp:14–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12 running = false;
13}
14void CloakTest::start()
15{
16 if (fail) return;
17 running = true;
18
19 int userCount = Broodwar->self()->completedUnitCount(unitType);
20 BWAssertF(userCount>=1,{fail=true;return;});
21 for (Unit u : Broodwar->self()->getUnits())
22 if (u->getType()==unitType)
23 unit = u;
24
25 BWAssertF(unit!=NULL,{fail=true;return;});
26 BWAssertF(unit->exists(),{fail=true;return;});
27 BWAssertF(unit->isCloaked()==false,{fail=true;return;});
28 BWAssertF(unit->getEnergy()>=50,{fail=true;return;});
29 currentEnergy = unit->getEnergy();
30 unit->cloak();
31 if (unitType==UnitTypes::Terran_Ghost)
32 currentEnergy-=TechTypes::Personnel_Cloaking.energyCost();
33 else
34 currentEnergy-=TechTypes::Cloaking_Field.energyCost();
35 BWAssertF(unit->getEnergy()==currentEnergy,{fail=true;return;});
36 BWAssertF(unit->getOrder()==Orders::Cloak,{fail=true;return;});
37 startFrame = Broodwar->getFrameCount();
38 nextFrame = Broodwar->getFrameCount();
39
40}
41void CloakTest::update()
42{
43 if (running == false) return;

Callers

nothing calls this directly

Calls 11

completedUnitCountMethod · 0.80
isCloakedMethod · 0.80
getEnergyMethod · 0.80
energyCostMethod · 0.80
selfMethod · 0.45
getUnitsMethod · 0.45
getTypeMethod · 0.45
existsMethod · 0.45
cloakMethod · 0.45
getOrderMethod · 0.45
getFrameCountMethod · 0.45

Tested by

no test coverage detected