diff options
author | Treeston <treeston.mmoc@gmail.com> | 2019-06-26 01:04:27 +0200 |
---|---|---|
committer | Treeston <treeston.mmoc@gmail.com> | 2019-06-26 01:04:27 +0200 |
commit | 3cdf27494ffe18d674a37561a2c573517a2cb533 (patch) | |
tree | 1350a1dbdae199e1527dc5782e97b76f4e02ee8a /src | |
parent | cb100d64d55c7af65d79c15131e2ebe0bf1cda86 (diff) |
Core/AI: Actually accurately reproduce the logic from before 849943 that determines what summons start following on appearance. Third time's the charm?
Closes #23513.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index b6feeaa51bf..3e109bf81e6 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -152,25 +152,50 @@ void CreatureAI::TriggerAlert(Unit const* who) const me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS, me->GetAbsoluteAngle(who)); } -void CreatureAI::JustAppeared() +// adapted from logic in Spell:EFfectSummonType before commit 849943 +static bool ShouldFollowOnSpawn(SummonPropertiesEntry const* properties) { - // Filter which type of summons apply the following follow handling - if (!me->IsSummon()) - return; - // Summons without SummonProperties are generally scripted summons that don't belong to any owner - TempSummon* summon = me->ToTempSummon(); - if (!summon->m_Properties || (summon->m_Properties->Category != SUMMON_CATEGORY_UNK && summon->m_Properties->Category != SUMMON_CATEGORY_PET)) - return; - - // Not applied to vehicles - if (summon->GetVehicle()) - return; + if (!properties) + return false; - if (Unit* owner = summon->GetCharmerOrOwner()) + switch (properties->Category) { - summon->GetMotionMaster()->Clear(); - summon->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, summon->GetFollowAngle()); + case SUMMON_CATEGORY_PET: + return true; + case SUMMON_CATEGORY_WILD: + case SUMMON_CATEGORY_ALLY: + case SUMMON_CATEGORY_UNK: + if (properties->Flags & 512) + return true; + switch (properties->Type) + { + case SUMMON_TYPE_PET: + case SUMMON_TYPE_GUARDIAN: + case SUMMON_TYPE_GUARDIAN2: + case SUMMON_TYPE_MINION: + case SUMMON_TYPE_MINIPET: + return true; + default: + return false; + } + default: + return false; + } +} +void CreatureAI::JustAppeared() +{ + if (TempSummon* summon = me->ToTempSummon()) + { + // Only apply this to specific types of summons + if (!summon->GetVehicle() && ShouldFollowOnSpawn(summon->m_Properties)) + { + if (Unit* owner = summon->GetCharmerOrOwner()) + { + summon->GetMotionMaster()->Clear(); + summon->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, summon->GetFollowAngle()); + } + } } } |