diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2018-01-04 04:46:22 +0100 |
|---|---|---|
| committer | Treeston <treeston.mmoc@gmail.com> | 2018-01-04 04:46:41 +0100 |
| commit | 9f9507e6a1fd50a5ce643a4096c1712700244a61 (patch) | |
| tree | 75829e0efab227ca03b01d4182b17410954e32fc /src/server/game/AI/CreatureAI.cpp | |
| parent | e2451136600bf4c30eb547bd8579f019cfd37a3d (diff) | |
Core/Misc: A variety of clean-up changes, mostly following up on 532ab1c to fix legacy bugs exposed by it:
- Triggers can no longer have a threat list (this may expose some ugliness in old legacy scripts)
- Threat entries are forced to OFFLINE if the AI refuses to attack the target
- Clean up passive creature evade behavior to be more consistent
- Fix a months old issue in spawn group management that would cause "Inactive" to incorrectly show in .list respawns for system groups outside of map 0
- Valithria script cleanups, remove old hacks and make it work with the new system. Closes #21174.
- Some strings cleanup
Diffstat (limited to 'src/server/game/AI/CreatureAI.cpp')
| -rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index d8fcb6c95c5..8f53e885416 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -80,11 +80,12 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= nullptr*/, float maxRange { if (Unit* summoner = creature->ToTempSummon()->GetSummoner()) { - Unit* target = summoner->getAttackerForHelper(); - if (!target && !summoner->GetThreatManager().IsThreatListEmpty()) - target = summoner->GetThreatManager().GetAnyTarget(); - if (target && (creature->IsFriendlyTo(summoner) || creature->IsHostileTo(target))) - creature->AI()->AttackStart(target); + if (creature->IsFriendlyTo(summoner)) + { + Unit* target = summoner->getAttackerForHelper(); + if (target && creature->IsHostileTo(target)) + creature->AI()->AttackStart(target); + } } } } @@ -105,7 +106,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= nullptr*/, float maxRange for (Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) if (Player* player = itr->GetSource()) if (player->IsAlive()) - creature->SetInCombatWith(player); + creature->EngageWithTarget(player); } // scripts does not take care about MoveInLineOfSight loops @@ -233,12 +234,12 @@ bool CreatureAI::UpdateVictim() return me->GetVictim() != nullptr; } - else if (me->GetThreatManager().IsThreatListEmpty(true)) + else if (!me->IsInCombat()) { EnterEvadeMode(EVADE_REASON_NO_HOSTILES); return false; } - else + else if (me->GetVictim()) me->AttackStop(); return true; |
