Core/Spells: detached Zanzili Fire from Zanzil's AI script to be usable by Dark Simulacrum
This commit is contained in:
1 parent
78a6d84689
commit
2ad8b1ee6f
1 file changed
+26
-44
@@ -17,12 +17,13 @@
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Spell.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellScript.h"
|
||||
#include "zulgurub.h"
|
||||
|
||||
@@ -86,12 +87,6 @@ enum Events
|
||||
EVENT_KNOCK_AWAY
|
||||
};
|
||||
|
||||
enum Actions
|
||||
{
|
||||
// Zanzil
|
||||
ACTION_CAST_ZANZILI_FLAME = 1
|
||||
};
|
||||
|
||||
enum SecretTechniques
|
||||
{
|
||||
TECHNIQUE_NONE = 0,
|
||||
@@ -145,7 +140,6 @@ struct boss_zanzil : public BossAI
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_zanziliFireCount = 0;
|
||||
_zombieGroupToRespawn = 0;
|
||||
_berserkerToRespawn = 0;
|
||||
_lastSecretTechnique = TECHNIQUE_NONE;
|
||||
@@ -223,36 +217,10 @@ struct boss_zanzil : public BossAI
|
||||
}
|
||||
}
|
||||
|
||||
void OnSpellCastFinished(SpellInfo const* spell, SpellFinishReason reason) override
|
||||
void OnSpellCastFinished(SpellInfo const* spell, SpellFinishReason /*reason*/) override
|
||||
{
|
||||
if (spell->Id == SPELL_VOODOO_BOLT)
|
||||
me->MakeInterruptable(false);
|
||||
|
||||
if (reason == SPELL_FINISHED_SUCCESSFUL_CAST && spell->Id == SPELL_ZANZILI_FIRE)
|
||||
_zanzilPosition = me->GetPosition();
|
||||
}
|
||||
|
||||
void DoAction(int32 action) override
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ACTION_CAST_ZANZILI_FLAME:
|
||||
{
|
||||
_zanziliFireCount++;
|
||||
float angle = _zanzilPosition.GetOrientation();
|
||||
float x = _zanzilPosition.GetPositionX() + cos(angle) * (2.0f * _zanziliFireCount);
|
||||
float y = _zanzilPosition.GetPositionY() + sin(angle) * (2.0f * _zanziliFireCount);
|
||||
float z = _zanzilPosition.GetPositionZ();
|
||||
|
||||
if (_zanzilPosition.GetExactDist2d(x, y) <= 30.0f)
|
||||
me->CastSpell({ x, y, z }, SPELL_ZANZILI_FIRE_TRIGGERED, true);
|
||||
else
|
||||
me->RemoveAurasDueToSpell(SPELL_ZANZILI_FIRE);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetGUID(ObjectGuid const& guid, int32 /*id*/) override
|
||||
@@ -275,7 +243,6 @@ struct boss_zanzil : public BossAI
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_ZANZILI_FIRE:
|
||||
_zanziliFireCount = 0;
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true))
|
||||
DoCast(target, SPELL_ZANZILI_FIRE);
|
||||
events.Repeat(13s, 14s);
|
||||
@@ -387,8 +354,6 @@ struct boss_zanzil : public BossAI
|
||||
}
|
||||
|
||||
private:
|
||||
Position _zanzilPosition;
|
||||
uint8 _zanziliFireCount;
|
||||
uint8 _zombieGroupToRespawn;
|
||||
uint8 _berserkerToRespawn;
|
||||
SecretTechniques _lastSecretTechnique;
|
||||
@@ -480,17 +445,34 @@ private:
|
||||
|
||||
class spell_zanzil_zanzili_fire : public AuraScript
|
||||
{
|
||||
void HandlePeriodic(AuraEffect const* /*aurEff*/)
|
||||
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Creature* zanzil = GetTarget()->ToCreature())
|
||||
if (zanzil->IsAIEnabled())
|
||||
zanzil->AI()->DoAction(ACTION_CAST_ZANZILI_FLAME);
|
||||
_applyPosition = GetUnitOwner()->GetPosition();
|
||||
}
|
||||
|
||||
void HandlePeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
if (aurEff->GetTickNumber() > 15)
|
||||
{
|
||||
Remove();
|
||||
return;
|
||||
}
|
||||
|
||||
Position dest = _applyPosition;
|
||||
float distance = aurEff->GetTickNumber() * 2.f;
|
||||
dest.m_positionX += std::cos(_applyPosition.GetOrientation()) * distance;
|
||||
dest.m_positionY += std::sin(_applyPosition.GetOrientation()) * distance;
|
||||
GetTarget()->CastSpell(dest, SPELL_ZANZILI_FIRE_TRIGGERED, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectApply.Register(&spell_zanzil_zanzili_fire::AfterApply, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
OnEffectPeriodic.Register(&spell_zanzil_zanzili_fire::HandlePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
|
||||
private:
|
||||
Position _applyPosition;
|
||||
};
|
||||
|
||||
class spell_zanzil_zanzils_resurrection_elixir : public AuraScript
|
||||
|
||||
Reference in new issue
Block a user