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

Private Member Functions

 PrepareSpellScript (spell_sindragosa_s_fury)
 
bool Load () override
 
void SelectDest ()
 
void CountTargets (std::list< WorldObject * > &targets)
 
void HandleDummy (SpellEffIndex effIndex)
 
void Register () override
 

Private Attributes

uint32 _targetCount
 

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
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
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 void Register ()=0
 
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< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
virtual bool _Validate (SpellInfo const *entry)
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CountTargets()

void spell_sindragosa_s_fury::CountTargets ( std::list< WorldObject * > &  targets)
inlineprivate
800 {
801 _targetCount = targets.size();
802 }
uint32 _targetCount
Definition: boss_sindragosa.cpp:832

References _targetCount.

Referenced by Register().

◆ HandleDummy()

void spell_sindragosa_s_fury::HandleDummy ( SpellEffIndex  effIndex)
inlineprivate
805 {
806 PreventHitDefaultEffect(effIndex);
807
808 if (!GetHitUnit()->IsAlive() || (GetHitUnit()->IsPlayer() && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount)
809 return;
810
811 float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask)));
812 float ResistFactor = ((resistance * 2.0f) / (resistance + 510.0f));
813 if (ResistFactor > 0.9f)
814 ResistFactor = 0.9f;
815
816 uint32 damage = uint32( (GetEffectValue() / _targetCount) * (1.0f - ResistFactor));
817
818 SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo(), GetSpellInfo()->SchoolMask);
819 damageInfo.damage = damage;
821 GetCaster()->DealSpellDamage(&damageInfo, false);
822 }
std::uint32_t uint32
Definition: Define.h:107
SpellSchoolMask
Definition: SharedDefines.h:295
Definition: Unit.h:489
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition: Unit.cpp:1439
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition: Unit.cpp:6281
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition: SpellScript.cpp:590
int32 GetEffectValue() const
Definition: SpellScript.cpp:600
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
Unit * GetCaster()
Definition: SpellScript.cpp:401

References _targetCount, SpellNonMeleeDamage::damage, Unit::DealSpellDamage(), SpellScript::GetCaster(), SpellScript::GetEffectValue(), SpellScript::GetHitUnit(), SpellScript::GetSpellInfo(), SpellScript::PreventHitDefaultEffect(), and Unit::SendSpellNonMeleeDamageLog().

Referenced by Register().

◆ Load()

bool spell_sindragosa_s_fury::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

775 {
776 _targetCount = 0;
777
778 // This script should execute only in Icecrown Citadel
779 if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
780 if (instance->GetInstanceScript())
781 if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName))
782 return true;
783
784 return false;
785 }
#define sObjectMgr
Definition: ObjectMgr.h:1623
#define ICCScriptName
Definition: icecrown_citadel.h:36
Definition: Map.h:819

References _targetCount, SpellScript::GetCaster(), ICCScriptName, and sObjectMgr.

◆ PrepareSpellScript()

spell_sindragosa_s_fury::PrepareSpellScript ( spell_sindragosa_s_fury  )
private

◆ Register()

void spell_sindragosa_s_fury::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

825 {
829 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:354
#define SpellCastFn(F)
Definition: SpellScript.h:324
@ EFFECT_1
Definition: SharedDefines.h:32
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:781
@ TARGET_UNIT_DEST_AREA_ENTRY
Definition: SharedDefines.h:1417
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
HookList< CastHandler > BeforeCast
Definition: SpellScript.h:319
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:353
void CountTargets(std::list< WorldObject * > &targets)
Definition: boss_sindragosa.cpp:799
void SelectDest()
Definition: boss_sindragosa.cpp:787
void HandleDummy(SpellEffIndex effIndex)
Definition: boss_sindragosa.cpp:804

References SpellScript::BeforeCast, CountTargets(), EFFECT_1, HandleDummy(), SpellScript::OnEffectHitTarget, SpellScript::OnObjectAreaTargetSelect, SelectDest(), SPELL_EFFECT_DUMMY, SpellCastFn, SpellEffectFn, SpellObjectAreaTargetSelectFn, and TARGET_UNIT_DEST_AREA_ENTRY.

◆ SelectDest()

void spell_sindragosa_s_fury::SelectDest ( )
inlineprivate
788 {
789 if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
790 {
791 float destX = float(rand_norm()) * 75.0f + 4350.0f;
792 float destY = float(rand_norm()) * 75.0f + 2450.0f;
793 float destZ = 205.0f; // random number close to ground, get exact in next call
794 GetCaster()->UpdateGroundPositionZ(destX, destY, destZ);
795 dest->Relocate(destX, destY, destZ);
796 }
797 }
double rand_norm()
Definition: Random.cpp:77
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition: Object.cpp:1530
Definition: Position.h:28
Definition: Position.h:251
WorldLocation const * GetExplTargetDest()
Definition: SpellScript.cpp:416

References SpellScript::GetCaster(), SpellScript::GetExplTargetDest(), rand_norm(), and WorldObject::UpdateGroundPositionZ().

Referenced by Register().

Member Data Documentation

◆ _targetCount

uint32 spell_sindragosa_s_fury::_targetCount
private

Referenced by CountTargets(), HandleDummy(), and Load().