fix(Scripts/Pets): Darting Hatchling not running around. (#15251)

* fix(Scripts/Pets): Darting Hatchling not running around.

* cs

* Update pet_generic.cpp

* RemoveAurasDueToSpell
This commit is contained in:
avarishd
2023-07-18 19:53:44 +03:00
committed by GitHub
parent 7ea62f1b7c
commit 08ed1fb47a
3 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
-- Darting Hatchling (pet)
UPDATE `creature_template_addon` SET `auras` = 62586 WHERE `entry` = 35396;
UPDATE `creature_template` SET `ScriptName` = 'npc_pet_darting_hatchling' WHERE `entry` = 35396;

View File

@@ -4547,6 +4547,12 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->MaxAffectedTargets = 1;
});
// Mulgore Hatchling (periodic)
ApplySpellFix({ 62586 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_0].TriggerSpell = 62585; // Mulgore Hatchling (fear)
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo* spellInfo = mSpellInfoMap[i];

View File

@@ -774,6 +774,49 @@ struct npc_pet_gen_moth : public NullCreatureAI
}
};
// Darting Hatchling
enum Darting
{
SPELL_DARTING_ON_SPAWN = 62586, // Applied on spawn via creature_template_addon
SPELL_DARTING_FEAR = 62585, // Applied every 20s from SPELL_DARTING_ON_SPAWN
};
struct npc_pet_darting_hatchling : public NullCreatureAI
{
npc_pet_darting_hatchling(Creature* c) : NullCreatureAI(c)
{
goFast = false;
checkTimer = 0;
}
bool goFast;
uint32 checkTimer;
void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_DARTING_FEAR)
{
goFast = true;
}
}
void UpdateAI(uint32 diff) override
{
if (!goFast)
{
return;
}
checkTimer += diff;
if (checkTimer >= 2000)
{
me->RemoveAurasDueToSpell(SPELL_DARTING_FEAR);
checkTimer = 0;
goFast = false;
}
}
};
void AddSC_generic_pet_scripts()
{
RegisterCreatureAI(npc_pet_gen_soul_trader_beacon);
@@ -788,4 +831,5 @@ void AddSC_generic_pet_scripts()
RegisterCreatureAI(npc_pet_gen_toxic_wasteling);
RegisterCreatureAI(npc_pet_gen_fetch_ball);
RegisterCreatureAI(npc_pet_gen_moth);
RegisterCreatureAI(npc_pet_darting_hatchling);
}