mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Pet/DK: Make Risen Ghoul and Bloodworms no longer suicidally charge into not-yet-engaged mob packs.
This commit is contained in:
@@ -43,21 +43,10 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
|
||||
struct npc_pet_dk_ebon_gargoyleAI : CasterAI
|
||||
{
|
||||
npc_pet_dk_ebon_gargoyleAI(Creature* creature) : CasterAI(creature)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
// Not needed to be despawned now
|
||||
_despawnTimer = 0;
|
||||
}
|
||||
npc_pet_dk_ebon_gargoyleAI(Creature* creature) : CasterAI(creature) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
Initialize();
|
||||
|
||||
CasterAI::InitializeAI();
|
||||
ObjectGuid ownerGuid = me->GetOwnerGUID();
|
||||
if (!ownerGuid)
|
||||
@@ -112,25 +101,8 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
me->GetMotionMaster()->MovePoint(0, x, y, z);
|
||||
|
||||
// Despawn as soon as possible
|
||||
_despawnTimer = 4 * IN_MILLISECONDS;
|
||||
me->DespawnOrUnsummon(Seconds(4));
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (_despawnTimer > 0)
|
||||
{
|
||||
if (_despawnTimer > diff)
|
||||
_despawnTimer -= diff;
|
||||
else
|
||||
me->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
|
||||
CasterAI::UpdateAI(diff);
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 _despawnTimer;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
@@ -139,7 +111,34 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
}
|
||||
};
|
||||
|
||||
class npc_pet_dk_guardian : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pet_dk_guardian() : CreatureScript("npc_pet_dk_guardian") { }
|
||||
|
||||
struct npc_pet_dk_guardianAI : public AggressorAI
|
||||
{
|
||||
npc_pet_dk_guardianAI(Creature* creature) : AggressorAI(creature) { }
|
||||
|
||||
bool CanAIAttack(Unit const* target) const override
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
Unit* owner = me->GetOwner();
|
||||
if (owner && !target->IsInCombatWith(owner))
|
||||
return false;
|
||||
return AggressorAI::CanAIAttack(target);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_pet_dk_guardianAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_deathknight_pet_scripts()
|
||||
{
|
||||
new npc_pet_dk_ebon_gargoyle();
|
||||
new npc_pet_dk_guardian();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user