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

Private Member Functions

 PrepareSpellScript (spell_sindragosa_s_fury_SpellScript)
 
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::spell_sindragosa_s_fury_SpellScript::CountTargets ( std::list< WorldObject * > &  targets)
inlineprivate
805 {
806 _targetCount = targets.size();
807 }
uint32 _targetCount
Definition: boss_sindragosa.cpp:836

References _targetCount.

Referenced by Register().

◆ HandleDummy()

void spell_sindragosa_s_fury::spell_sindragosa_s_fury_SpellScript::HandleDummy ( SpellEffIndex  effIndex)
inlineprivate
810 {
811 PreventHitDefaultEffect(effIndex);
812
813 if (!GetHitUnit()->IsAlive() || (GetHitUnit()->GetTypeId() == TYPEID_PLAYER && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount)
814 return;
815
816 float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask)));
817 float ResistFactor = ((resistance * 2.0f) / (resistance + 510.0f));
818 if (ResistFactor > 0.9f)
819 ResistFactor = 0.9f;
820
821 uint32 damage = uint32( (GetEffectValue() / _targetCount) * (1.0f - ResistFactor) );
822
823 SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo(), GetSpellInfo()->SchoolMask);
824 damageInfo.damage = damage;
826 GetCaster()->DealSpellDamage(&damageInfo, false);
827 }
std::uint32_t uint32
Definition: Define.h:108
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
SpellSchoolMask
Definition: SharedDefines.h:295
Definition: Unit.h:920
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition: Unit.cpp:1440
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition: Unit.cpp:6248
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(), Unit::SendSpellNonMeleeDamageLog(), and TYPEID_PLAYER.

Referenced by Register().

◆ Load()

bool spell_sindragosa_s_fury::spell_sindragosa_s_fury_SpellScript::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

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

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

◆ PrepareSpellScript()

spell_sindragosa_s_fury::spell_sindragosa_s_fury_SpellScript::PrepareSpellScript ( spell_sindragosa_s_fury_SpellScript  )
private

◆ Register()

void spell_sindragosa_s_fury::spell_sindragosa_s_fury_SpellScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

830 {
834 }
#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:804
void SelectDest()
Definition: boss_sindragosa.cpp:792
void HandleDummy(SpellEffIndex effIndex)
Definition: boss_sindragosa.cpp:809

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::spell_sindragosa_s_fury_SpellScript::SelectDest ( )
inlineprivate
793 {
794 if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
795 {
796 float destX = float(rand_norm()) * 75.0f + 4350.0f;
797 float destY = float(rand_norm()) * 75.0f + 2450.0f;
798 float destZ = 205.0f; // random number close to ground, get exact in next call
799 GetCaster()->UpdateGroundPositionZ(destX, destY, destZ);
800 dest->Relocate(destX, destY, destZ);
801 }
802 }
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::spell_sindragosa_s_fury_SpellScript::_targetCount
private

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