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
802 {
803 _targetCount = targets.size();
804 }
uint32 _targetCount
Definition: boss_sindragosa.cpp:834

References _targetCount.

Referenced by Register().

◆ HandleDummy()

void spell_sindragosa_s_fury::HandleDummy ( SpellEffIndex  effIndex)
inlineprivate
807 {
808 PreventHitDefaultEffect(effIndex);
809
810 if (!GetHitUnit()->IsAlive() || (GetHitUnit()->IsPlayer() && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount)
811 return;
812
813 float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask)));
814 float ResistFactor = ((resistance * 2.0f) / (resistance + 510.0f));
815 if (ResistFactor > 0.9f)
816 ResistFactor = 0.9f;
817
818 uint32 damage = uint32( (GetEffectValue() / _targetCount) * (1.0f - ResistFactor));
819
820 SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo(), GetSpellInfo()->SchoolMask);
821 damageInfo.damage = damage;
823 GetCaster()->DealSpellDamage(&damageInfo, false);
824 }
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:1438
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition: Unit.cpp:6310
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.

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

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.

827 {
831 }
@ EFFECT_1
Definition: SharedDefines.h:32
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:781
@ TARGET_UNIT_DEST_AREA_ENTRY
Definition: SharedDefines.h:1417
#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
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:801
void SelectDest()
Definition: boss_sindragosa.cpp:789
void HandleDummy(SpellEffIndex effIndex)
Definition: boss_sindragosa.cpp:806

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
790 {
791 if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
792 {
793 float destX = float(rand_norm()) * 75.0f + 4350.0f;
794 float destY = float(rand_norm()) * 75.0f + 2450.0f;
795 float destZ = 205.0f; // random number close to ground, get exact in next call
796 GetCaster()->UpdateGroundPositionZ(destX, destY, destZ);
797 dest->Relocate(destX, destY, destZ);
798 }
799 }
double rand_norm()
Definition: Random.cpp:77
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition: Object.cpp:1541
Definition: Position.h:27
Definition: Position.h:250
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().