mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 10:55:43 +00:00
fix(Script/Creature): Add random delay to Gargoyle casts (#22512)
This commit is contained in:
@@ -47,6 +47,8 @@ enum DeathKnightSpells
|
||||
// Risen Ally
|
||||
SPELL_DK_RAISE_ALLY = 46619,
|
||||
SPELL_GHOUL_FRENZY = 62218,
|
||||
// Gargoyle
|
||||
SPELL_GARGOYLE_STRIKE = 51963,
|
||||
};
|
||||
|
||||
struct npc_pet_dk_ebon_gargoyle : ScriptedAI
|
||||
@@ -89,12 +91,13 @@ struct npc_pet_dk_ebon_gargoyle : ScriptedAI
|
||||
me->AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
|
||||
_selectionTimer = 2000;
|
||||
_initialCastTimer = 0;
|
||||
_decisionTimer = 0;
|
||||
}
|
||||
|
||||
void MySelectNextTarget()
|
||||
{
|
||||
Unit* owner = me->GetOwner();
|
||||
if (owner && owner->IsPlayer() && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(51963)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim())))
|
||||
if (owner && owner->IsPlayer() && (!me->GetVictim() || me->GetVictim()->IsImmunedToSpell(sSpellMgr->GetSpellInfo(SPELL_GARGOYLE_STRIKE)) || !me->IsValidAttackTarget(me->GetVictim()) || !owner->CanSeeOrDetect(me->GetVictim())))
|
||||
{
|
||||
Unit* selection = owner->ToPlayer()->GetSelectedUnit();
|
||||
if (selection && selection != me->GetVictim() && me->IsValidAttackTarget(selection))
|
||||
@@ -118,7 +121,7 @@ struct npc_pet_dk_ebon_gargoyle : ScriptedAI
|
||||
RemoveTargetAura();
|
||||
_targetGUID = who->GetGUID();
|
||||
me->AddAura(SPELL_DK_SUMMON_GARGOYLE_1, who);
|
||||
ScriptedAI::AttackStart(who);
|
||||
ScriptedAI::AttackStartCaster(who, 40);
|
||||
}
|
||||
|
||||
void RemoveTargetAura()
|
||||
@@ -184,6 +187,7 @@ struct npc_pet_dk_ebon_gargoyle : ScriptedAI
|
||||
if (_despawnTimer > 4000)
|
||||
{
|
||||
_despawnTimer -= diff;
|
||||
_decisionTimer -= diff;
|
||||
if (!UpdateVictimWithGaze())
|
||||
{
|
||||
MySelectNextTarget();
|
||||
@@ -197,8 +201,23 @@ struct npc_pet_dk_ebon_gargoyle : ScriptedAI
|
||||
MySelectNextTarget();
|
||||
_selectionTimer = 0;
|
||||
}
|
||||
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);
|
||||
|
||||
if (_decisionTimer <= 0)
|
||||
{
|
||||
_decisionTimer += 400;
|
||||
if (_initialCastTimer >= 2000 && !me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_LOST_CONTROL) && me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE && rand_chance() > 20.0f)
|
||||
{
|
||||
if (me->HasSilenceAura() || me->IsSpellProhibited(SPELL_SCHOOL_MASK_NATURE))
|
||||
{
|
||||
me->GetMotionMaster()->MoveChase(me->GetVictim());
|
||||
}
|
||||
else
|
||||
{
|
||||
me->GetMotionMaster()->MoveChase(me->GetVictim(), 40);
|
||||
DoCastVictim(SPELL_GARGOYLE_STRIKE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -217,6 +236,7 @@ private:
|
||||
uint32 _despawnTimer;
|
||||
uint32 _selectionTimer;
|
||||
uint32 _initialCastTimer;
|
||||
int32 _decisionTimer;
|
||||
bool _despawning;
|
||||
bool _initialSelection;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user