MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / validTarget

Method validTarget

src/Battlescape/AlienBAIState.cpp:1916–1936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1914}
1915
1916bool AlienBAIState::validTarget(BattleUnit *unit, bool assessDanger, bool includeCivs) const
1917{
1918 // ignore units that are dead/unconscious
1919 if (unit->isOut() ||
1920 // they must be units that we "know" about
1921 _intelligence < unit->getTurnsSinceSpotted() ||
1922 // they haven't been grenaded
1923 (assessDanger && unit->getTile()->getDangerous()) ||
1924 // and they mustn't be on our side
1925 unit->getFaction() == FACTION_HOSTILE)
1926 {
1927 return false;
1928 }
1929
1930 if (includeCivs)
1931 {
1932 return true;
1933 }
1934
1935 return unit->getFaction() == FACTION_PLAYER;
1936}
1937}

Callers

nothing calls this directly

Calls 5

isOutMethod · 0.80
getTurnsSinceSpottedMethod · 0.80
getDangerousMethod · 0.80
getFactionMethod · 0.80
getTileMethod · 0.45

Tested by

no test coverage detected