MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / AiPlanPath

Function AiPlanPath

Source/monster.cpp:1763–1794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1761}
1762
1763bool AiPlanPath(Monster &monster)
1764{
1765 if (monster.type().type != MT_GOLEM) {
1766 if (monster.activeForTicks == 0)
1767 return false;
1768 if (monster.mode != MonsterMode::Stand)
1769 return false;
1770 if (IsNoneOf(monster.goal, MonsterGoal::Normal, MonsterGoal::Move, MonsterGoal::Attack))
1771 return false;
1772 if (monster.position.tile == GolemHoldingCell)
1773 return false;
1774 }
1775
1776 bool clear = LineClear(
1777 [&monster](Point position) { return IsTileAvailable(monster, position); },
1778 monster.position.tile,
1779 monster.enemyPosition);
1780 if (!clear || (monster.pathCount >= 5 && monster.pathCount < 8)) {
1781 if ((monster.flags & MFLAG_CAN_OPEN_DOOR) != 0)
1782 MonstCheckDoors(monster);
1783 monster.pathCount++;
1784 if (monster.pathCount < 5)
1785 return false;
1786 if (AiPlanWalk(monster))
1787 return true;
1788 }
1789
1790 if (monster.type().type != MT_GOLEM)
1791 monster.pathCount = 0;
1792
1793 return false;
1794}
1795
1796void AiAvoidance(Monster &monster)
1797{

Callers 2

GolumAiFunction · 0.85
ProcessMonstersFunction · 0.85

Calls 6

IsNoneOfFunction · 0.85
LineClearFunction · 0.85
IsTileAvailableFunction · 0.85
MonstCheckDoorsFunction · 0.85
AiPlanWalkFunction · 0.85
typeMethod · 0.45

Tested by

no test coverage detected