Skip to content

Commit

Permalink
Incorrect AI aggression as a consequence of the LineOfSight change, e…
Browse files Browse the repository at this point in the history
…pisode three, revenge of the special AIs. Also, hopefully the last. No original trilogy please.

(cherry picked from commit ab194d5)
  • Loading branch information
Treeston authored and Shauren committed Apr 8, 2016
1 parent aca9efc commit b2e4a96
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
Expand Up @@ -105,7 +105,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who)

void npc_escortAI::MoveInLineOfSight(Unit* who)
{
if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
{
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who))
return;
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
Expand Up @@ -102,7 +102,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who)

void FollowerAI::MoveInLineOfSight(Unit* who)
{
if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who))
return;
Expand Down
3 changes: 3 additions & 0 deletions src/server/game/AI/SmartScripts/SmartAI.cpp
Expand Up @@ -466,6 +466,9 @@ bool SmartAI::CanAIAttack(const Unit* /*who*/) const

bool SmartAI::AssistPlayerInCombat(Unit* who)
{
if (me->HasReactState(REACT_PASSIVE))
return;

if (!who || !who->GetVictim())
return false;

Expand Down

0 comments on commit b2e4a96

Please sign in to comment.