Skip to content

Commit

Permalink
AI: Enforce evade of critters on flee end
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Apr 24, 2022
1 parent 5f8ff7b commit a0fc3c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/game/AI/BaseAI/CreatureAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ void CreatureAI::EnterCombat(Unit* enemy)
UnitAI::EnterCombat(enemy);
// TODO: Monitor this condition to see if it conflicts with any pets
if (m_creature->IsCritter() && !m_creature->IsPet() && !m_creature->IsInPanic() && enemy && enemy->IsPlayerControlled())
{
DoFlee(30000);
SetAIOrder(ORDER_CRITTER_FLEE); // mark as critter flee for custom handling
}
if (enemy && (m_creature->IsGuard() || m_creature->IsCivilian()))
{
// Send Zone Under Attack message to the LocalDefense and WorldDefense Channels
Expand Down Expand Up @@ -252,4 +255,10 @@ void CreatureAI::TimedFleeingEnded()
if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLEE_FROM_CALL_FOR_HELP)
EnterEvadeMode();
}
if (GetAIOrder() == ORDER_CRITTER_FLEE && m_creature->IsAlive())
{
SetCombatScriptStatus(false);
EnterEvadeMode();
}
SetAIOrder(ORDER_NONE);
}
1 change: 1 addition & 0 deletions src/game/AI/BaseAI/UnitAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ enum AIOrders
ORDER_RETREATING,
ORDER_EVADE,
ORDER_FLEE_FROM_CALL_FOR_HELP,
ORDER_CRITTER_FLEE,
ORDER_CUSTOM,
};

Expand Down

0 comments on commit a0fc3c3

Please sign in to comment.