mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/AI: Remove EnterEvadeMode calls from Guardian/Summon spell handlers. Add follow logic to CreatureAI::JustAppeared. Closes #23270.
This commit is contained in:
@@ -151,6 +151,18 @@ void CreatureAI::TriggerAlert(Unit const* who) const
|
||||
me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS, me->GetAbsoluteAngle(who));
|
||||
}
|
||||
|
||||
void CreatureAI::JustAppeared()
|
||||
{
|
||||
if (!me->GetVehicle())
|
||||
{
|
||||
if (Unit* owner = me->GetCharmerOrOwner())
|
||||
{
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreatureAI::EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
if (!_EnterEvadeMode(why))
|
||||
|
||||
@@ -141,7 +141,7 @@ class TC_GAME_API CreatureAI : public UnitAI
|
||||
virtual bool IsEscorted() const { return false; }
|
||||
|
||||
// Called when creature appears in the world (spawn, respawn, grid load etc...)
|
||||
virtual void JustAppeared() { }
|
||||
virtual void JustAppeared();
|
||||
|
||||
// Called at waypoint reached or point movement finished
|
||||
virtual void MovementInform(uint32 /*type*/, uint32 /*id*/) { }
|
||||
|
||||
@@ -2245,8 +2245,6 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
summon->SelectLevel(); // some summoned creaters have different from 1 DB data for level/hp
|
||||
summon->SetUInt32Value(UNIT_NPC_FLAGS, summon->GetCreatureTemplate()->npcflag);
|
||||
summon->SetImmuneToAll(true);
|
||||
|
||||
summon->AI()->EnterEvadeMode();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -5357,8 +5355,6 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
|
||||
summon->SetDisplayId(1126); // modelid1
|
||||
}
|
||||
|
||||
summon->AI()->EnterEvadeMode();
|
||||
|
||||
ExecuteLogEffectSummonObject(i, summon);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user