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

References _targetCount.

Referenced by Register().

◆ HandleDummy()

void spell_sindragosa_s_fury::spell_sindragosa_s_fury_SpellScript::HandleDummy ( SpellEffIndex  effIndex)
inlineprivate
838 {
839 PreventHitDefaultEffect(effIndex);
840
841 if (!GetHitUnit()->IsAlive() || (GetHitUnit()->GetTypeId() == TYPEID_PLAYER && GetHitUnit()->ToPlayer()->IsGameMaster()) || !_targetCount)
842 return;
843
844 float resistance = float(GetHitUnit()->GetResistance(SpellSchoolMask(GetSpellInfo()->SchoolMask)));
845 float ResistFactor = ((resistance * 2.0f) / (resistance + 510.0f));
846 if (ResistFactor > 0.9f)
847 ResistFactor = 0.9f;
848
849 uint32 damage = uint32( (GetEffectValue() / _targetCount) * (1.0f - ResistFactor) );
850
851 SpellNonMeleeDamage damageInfo(GetCaster(), GetHitUnit(), GetSpellInfo(), GetSpellInfo()->SchoolMask);
852 damageInfo.damage = damage;
854 GetCaster()->DealSpellDamage(&damageInfo, false);
855 }
std::uint32_t uint32
Definition: Define.h:108
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
SpellSchoolMask
Definition: SharedDefines.h:267
Definition: Unit.h:908
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
Definition: Unit.cpp:1435
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition: Unit.cpp:6222
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.

808 {
809 _targetCount = 0;
810
811 // This script should execute only in Icecrown Citadel
812 if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap())
813 if (instance->GetInstanceScript())
814 if (instance->GetScriptId() == sObjectMgr->GetScriptId(ICCScriptName))
815 return true;
816
817 return false;
818 }
#define sObjectMgr
Definition: ObjectMgr.h:1640
#define ICCScriptName
Definition: icecrown_citadel.h:37
Definition: Map.h:813

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.

858 {
862 }
#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:31
@ SPELL_EFFECT_DUMMY
Definition: SharedDefines.h:753
@ TARGET_UNIT_DEST_AREA_ENTRY
Definition: SharedDefines.h:1389
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:832
void SelectDest()
Definition: boss_sindragosa.cpp:820
void HandleDummy(SpellEffIndex effIndex)
Definition: boss_sindragosa.cpp:837

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
821 {
822 if (Position* dest = const_cast<WorldLocation*>(GetExplTargetDest()))
823 {
824 float destX = float(rand_norm()) * 75.0f + 4350.0f;
825 float destY = float(rand_norm()) * 75.0f + 2450.0f;
826 float destZ = 205.0f; // random number close to ground, get exact in next call
827 GetCaster()->UpdateGroundPositionZ(destX, destY, destZ);
828 dest->Relocate(destX, destY, destZ);
829 }
830 }
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().