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

Method DecloakCheck

bwapi/BWScriptEmulator/ComputerAI.cpp:46–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void UnitWrap::DecloakCheck()
47{
48 // Ignore if not cloaked/cloakable
49 if ( !pUnit->isCloaked() || !pUnit->getType().isCloakable() )
50 return;
51
52 // Ignore if busy with enemy
53 if ( HasEnemyTarget() )
54 return;
55
56 // Ignore if auto-targetting something?
57 //if ( pUnit->AIOrderTargetUnit )
58 // return;
59
60 // Ignore if there's a nearby enemy unit
61 if ( pUnit->getClosestUnit(IsEnemy && CanAttack, 256) )
62 return;
63
64 if ( pUnit->getOrder() != Orders::NukeWait &&
65 pUnit->getOrder() != Orders::NukePaint &&
66 pUnit->getOrder() != Orders::NukeTrack )
67 pUnit->decloak();
68}
69
70bool UnitWrap::DoUnitBehaviour()
71{

Callers

nothing calls this directly

Calls 6

isCloakedMethod · 0.80
isCloakableMethod · 0.80
getTypeMethod · 0.45
getClosestUnitMethod · 0.45
getOrderMethod · 0.45
decloakMethod · 0.45

Tested by

no test coverage detected