fix(DB/SAI): Use SAI for Spitelash Naga in Azshara (#15808)

* Add SAI for Spitelash Naga in Azshara
This commit is contained in:
Timothy Vaccarelli
2023-04-22 09:22:34 -04:00
committed by GitHub
parent 5e9e8e2abd
commit 309f5c4adf
2 changed files with 73 additions and 92 deletions

View File

@@ -23,7 +23,6 @@ SDCategory: Azshara
EndScriptData */
/* ContentData
npc_spitelashes
npc_rizzle_sprysprocket
npc_depth_charge
EndContentData */
@@ -34,96 +33,6 @@ EndContentData */
#include "ScriptedGossip.h"
#include "SpellInfo.h"
/*######
## npc_spitelashes
######*/
enum Spitelashes
{
SPELL_POLYMORPH_RANK1 = 118,
SPELL_POLYMORPH_RANK2 = 12824,
SPELL_POLYMORPH_RANK3 = 12825,
SPELL_POLYMORPH_RANK4 = 12826,
SPELL_POLYMORPH = 29124,
SPELL_POLYMORPH_BACKFIRE = 28406,
SPELL_REMOVE_POLYMORPH = 6924
};
class npc_spitelashes : public CreatureScript
{
public:
npc_spitelashes() : CreatureScript("npc_spitelashes") { }
struct npc_spitelashesAI : public ScriptedAI
{
npc_spitelashesAI(Creature* creature) : ScriptedAI(creature) { }
uint32 morphtimer;
bool spellhit;
void Reset() override
{
morphtimer = 0;
spellhit = false;
}
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(Unit* unit, SpellInfo const* spell) override
{
if (spellhit)
return;
switch (spell->Id)
{
case SPELL_POLYMORPH_RANK1:
case SPELL_POLYMORPH_RANK2:
case SPELL_POLYMORPH_RANK3:
case SPELL_POLYMORPH_RANK4:
if (Player* player = unit->ToPlayer())
if (player->GetQuestStatus(9364) == QUEST_STATUS_INCOMPLETE)
{
spellhit = true;
DoCast(me, SPELL_POLYMORPH);
}
break;
default:
break;
}
}
void UpdateAI(uint32 diff) override
{
// we mustn't remove the Creature in the same round in which we cast the summon spell, otherwise there will be no summons
if (spellhit && morphtimer >= 5000)
{
me->DespawnOrUnsummon();
return;
}
// walk 5 seconds before summoning
if (spellhit && morphtimer < 5000)
{
morphtimer += diff;
if (morphtimer >= 5000)
{
DoCast(me, SPELL_POLYMORPH_BACKFIRE); // summon copies
DoCast(me, SPELL_REMOVE_POLYMORPH); // visual explosion
}
}
if (!UpdateVictim())
return;
/// @todo add abilities for the different creatures
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_spitelashesAI(creature);
}
};
/*####
# npc_rizzle_sprysprocket
####*/
@@ -460,7 +369,6 @@ public:
void AddSC_azshara()
{
new npc_spitelashes();
new npc_rizzle_sprysprocket();
new npc_depth_charge();
}