mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
Core/Pet: Gargoyle now attacks Ghoul target, thx Harlock
This commit is contained in:
@@ -50,7 +50,11 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
_despawnTimer = 36000; // 30 secs + 4 fly out + 2 initial attack timer
|
||||
_despawning = false;
|
||||
_initialSelection = true;
|
||||
_ghoulSelection = true;
|
||||
|
||||
_targetGUID = 0;
|
||||
_markedTargetGUID = 0;
|
||||
_ghoulTargetGUID = 0;
|
||||
}
|
||||
|
||||
void MovementInform(uint32 type, uint32 point)
|
||||
@@ -171,9 +175,52 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
(*iter)->RemoveAura(SPELL_DK_SUMMON_GARGOYLE_1, me->GetOwnerGUID());
|
||||
SetGazeOn(*iter);
|
||||
_targetGUID = (*iter)->GetGUID();
|
||||
_markedTargetGUID = _targetGUID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_ghoulSelection) //find pet ghoul target
|
||||
{
|
||||
std::list<Unit*> targets;
|
||||
Trinity::AnyFriendlyUnitInObjectRangeCheck ghoul_check(me, me, 50);
|
||||
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(me, targets, ghoul_check);
|
||||
me->VisitNearbyObject(50, searcher);
|
||||
for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->GetEntry() == 26125) // ghoul entry
|
||||
{
|
||||
if ((*iter)->GetOwnerGUID() == me->GetOwnerGUID()) // same owner
|
||||
{
|
||||
_ghoulTargetGUID = (*iter)->GetTarget();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Unit* ghoulTarget = ObjectAccessor::GetUnit(*me, _ghoulTargetGUID))
|
||||
{
|
||||
if(ghoulTarget->IsAlive())
|
||||
{
|
||||
AttackStart(ghoulTarget);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_ghoulSelection = false; // check for ghoul at next update.
|
||||
|
||||
if (Unit* markedTarget = ObjectAccessor::GetUnit(*me, _markedTargetGUID))
|
||||
{
|
||||
if (markedTarget->IsAlive())
|
||||
{
|
||||
AttackStart(markedTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_despawnTimer > 4000)
|
||||
{
|
||||
_despawnTimer -= diff;
|
||||
@@ -190,7 +237,7 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
MySelectNextTarget();
|
||||
_selectionTimer = 0;
|
||||
}
|
||||
if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING|UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
|
||||
if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
|
||||
me->CastSpell(me->GetVictim(), 51963, false);
|
||||
}
|
||||
else
|
||||
@@ -207,11 +254,14 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
|
||||
|
||||
private:
|
||||
uint64 _targetGUID;
|
||||
uint64 _ghoulTargetGUID;
|
||||
uint64 _markedTargetGUID;
|
||||
uint32 _despawnTimer;
|
||||
uint32 _selectionTimer;
|
||||
uint32 _initialCastTimer;
|
||||
bool _despawning;
|
||||
bool _initialSelection;
|
||||
bool _ghoulSelection;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
|
||||
Reference in New Issue
Block a user