AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
spell_icc_geist_alarm Class Reference
Inheritance diagram for spell_icc_geist_alarm:
SpellScript _SpellScript

Private Member Functions

 PrepareSpellScript (spell_icc_geist_alarm)
 
void HandleEvent (SpellEffIndex effIndex)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
Unit * GetCaster ()
 
GameObject * GetGObjCaster ()
 
Unit * GetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObject * GetExplTargetWorldObject ()
 
Unit * GetExplTargetUnit ()
 
GameObject * GetExplTargetGObj ()
 
Item * GetExplTargetItem ()
 
Unit * GetHitUnit ()
 
Creature * GetHitCreature ()
 
Player * GetHitPlayer ()
 
Item * GetHitItem ()
 
GameObject * GetHitGObj ()
 
WorldLocation * GetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
Spell * GetSpell ()
 
Aura * GetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
Item * GetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- Public Member Functions inherited from _SpellScript
 _SpellScript ()
 
virtual ~_SpellScript ()
 
virtual void _Register ()
 
virtual void _Unload ()
 
virtual void _Init (std::string const *scriptname, uint32 spellId)
 
std::string const * _GetScriptName () const
 
virtual bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
virtual void Unload ()
 
- Static Public Member Functions inherited from _SpellScript
static bool ValidateSpellInfo (std::initializer_list< uint32 > spellIds)
 
template<class T >
static bool ValidateSpellInfo (T const &spellIds)
 
- Public Attributes inherited from SpellScript
HookList< CastHandler > BeforeCast
 
HookList< CastHandler > OnCast
 
HookList< CastHandler > AfterCast
 
HookList< CheckCastHandler > OnCheckCast
 
HookList< EffectHandler > OnEffectLaunch
 
HookList< EffectHandler > OnEffectLaunchTarget
 
HookList< EffectHandler > OnEffectHit
 
HookList< EffectHandler > OnEffectHitTarget
 
HookList< BeforeHitHandler > BeforeHit
 
HookList< HitHandler > OnHit
 
HookList< HitHandler > AfterHit
 
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
 
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ HandleEvent()

void spell_icc_geist_alarm::HandleEvent ( SpellEffIndex  effIndex)
inlineprivate
2770 {
2771 PreventHitDefaultEffect(effIndex);
2772
2773 // the alarms are ownerless trap gameobjects casting on their own
2774 WorldObject* caster = GetCaster();
2775 if (!caster)
2776 caster = GetGObjCaster();
2777 if (!caster)
2778 return;
2779
2780 if (InstanceScript* instance = caster->GetInstanceScript())
2781 {
2782 Position p = {4356.77f, 2971.90f, 360.52f, M_PI / 2};
2783 if (Creature* l = instance->instance->SummonCreature(NPC_VENGEFUL_FLESHREAPER, p))
2784 {
2785 bool hasTarget = false;
2786 Unit* target = nullptr;
2787 if ((target = l->SelectNearestTarget(20.0f)))
2788 hasTarget = true;
2789 else
2790 {
2791 target = l->SelectNearestTarget(120.0f);
2792 l->GetMotionMaster()->MoveJump(l->GetPositionX(), l->GetPositionY() + 55.0f, l->GetPositionZ(), 20.0f, 6.0f);
2793 }
2794 l->AI()->Talk(0);
2795 l->AI()->AttackStart(target);
2796 l->AddThreat(target, 1.0f);
2797 for (uint8 i = 0; i < 5; ++i)
2798 {
2799 float dist = 2.0f + rand_norm() * 4.0f;
2800 float angle = rand_norm() * 2 * M_PI;
2801 Position pos(p);
2802 l->MovePosition(pos, dist, angle);
2804 {
2805 c->AI()->AttackStart(l->GetVictim());
2806 c->AddThreat(l->GetVictim(), 1.0f);
2807 if (!hasTarget)
2808 c->GetMotionMaster()->MoveJump(c->GetPositionX(), c->GetPositionY() + 55.0f, c->GetPositionZ(), 20.0f, 6.0f);
2809 }
2810 }
2811 }
2812 }
2813 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
constexpr auto MINUTE
Definition Common.h:47
std::uint8_t uint8
Definition Define.h:109
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:53
double rand_norm()
Definition Random.cpp:85
Definition Creature.h:47
Definition InstanceScript.h:143
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=0)
Definition MotionMaster.h:257
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition SpellScript.cpp:595
GameObject * GetGObjCaster()
Definition SpellScript.cpp:406
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:670
MotionMaster * GetMotionMaster()
Definition Unit.h:1774
Definition Object.h:482
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1247
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition Object.cpp:2460
@ NPC_VENGEFUL_FLESHREAPER
Definition icecrown_citadel.h:391
Definition Position.h:27

References SpellScript::GetCaster(), SpellScript::GetGObjCaster(), WorldObject::GetInstanceScript(), Unit::GetMotionMaster(), IN_MILLISECONDS, MINUTE, MotionMaster::MoveJump(), NPC_VENGEFUL_FLESHREAPER, SpellScript::PreventHitDefaultEffect(), rand_norm(), WorldObject::SummonCreature(), and TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT.

Referenced by Register().

◆ PrepareSpellScript()

spell_icc_geist_alarm::PrepareSpellScript ( spell_icc_geist_alarm  )
private

◆ Register()

void spell_icc_geist_alarm::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

2816 {
2818 }
@ EFFECT_2
Definition SharedDefines.h:33
@ SPELL_EFFECT_SEND_EVENT
Definition SharedDefines.h:827
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
HookList< EffectHandler > OnEffectHit
Definition SpellScript.h:335
void HandleEvent(SpellEffIndex effIndex)
Definition icecrown_citadel.cpp:2769

References EFFECT_2, HandleEvent(), SpellScript::OnEffectHit, SPELL_EFFECT_SEND_EVENT, and SpellEffectFn.


The documentation for this class was generated from the following file: