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

Method FindNewAttackTarget

bwapi/BWScriptEmulator/OrderEmulate.cpp:72–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72BWAPI::Unit UnitWrap::FindNewAttackTarget() const
73{
74 UnitType t = pUnit->getType();
75
76 Unit pTarg = pUnit->getClosestUnit( IsEnemy &&
77 [this](Unit u){ return pUnit->isInWeaponRange(u);} &&
78 IsVisible &&
79 !IsInvincible, std::max(t.seekRange(),t.sightRange())*32 );
80 // Should be greatly expanded, but for now something simple
81 return pTarg;
82}

Callers

nothing calls this directly

Calls 5

isInWeaponRangeMethod · 0.80
seekRangeMethod · 0.80
getTypeMethod · 0.45
getClosestUnitMethod · 0.45
sightRangeMethod · 0.45

Tested by

no test coverage detected