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

Private Member Functions

 PrepareAuraScript (spell_dk_dancing_rune_weapon)
 
bool CheckProc (ProcEventInfo &eventInfo)
 
void HandleProc (AuraEffect const *aurEff, ProcEventInfo &eventInfo)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from AuraScript
 AuraScript ()
 
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Aura *aura)
 
void _PrepareScriptCall (AuraScriptHookType hookType, AuraApplication const *aurApp=nullptr)
 
void _FinishScriptCall ()
 
bool _IsDefaultActionPrevented ()
 
void PreventDefaultAction ()
 
SpellInfo const * GetSpellInfo () const
 
uint32 GetId () const
 
ObjectGuid GetCasterGUID () const
 
UnitGetCaster () const
 
WorldObjectGetOwner () const
 
UnitGetUnitOwner () const
 
DynamicObjectGetDynobjOwner () const
 
void Remove (uint32 removeMode=0)
 
AuraGetAura () const
 
AuraObjectType GetType () const
 
int32 GetDuration () const
 
void SetDuration (int32 duration, bool withMods=false)
 
void RefreshDuration ()
 
time_t GetApplyTime () const
 
int32 GetMaxDuration () const
 
void SetMaxDuration (int32 duration)
 
int32 CalcMaxDuration () const
 
bool IsExpired () const
 
bool IsPermanent () const
 
uint8 GetCharges () const
 
void SetCharges (uint8 charges)
 
uint8 CalcMaxCharges () const
 
bool ModCharges (int8 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool DropCharge (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
uint8 GetStackAmount () const
 
void SetStackAmount (uint8 num)
 
bool ModStackAmount (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool IsPassive () const
 
bool IsDeathPersistent () const
 
bool HasEffect (uint8 effIndex) const
 
AuraEffectGetEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
UnitGetTarget () const
 
AuraApplication const * GetTargetApplication () const
 
- 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 AuraScript
HookList< CheckAreaTargetHandlerDoCheckAreaTarget
 
HookList< AuraDispelHandlerOnDispel
 
HookList< AuraDispelHandlerAfterDispel
 
HookList< EffectApplyHandlerOnEffectApply
 
HookList< EffectApplyHandlerAfterEffectApply
 
HookList< EffectApplyHandlerOnEffectRemove
 
HookList< EffectApplyHandlerAfterEffectRemove
 
HookList< EffectPeriodicHandlerOnEffectPeriodic
 
HookList< EffectUpdatePeriodicHandlerOnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandlerDoEffectCalcAmount
 
HookList< EffectCalcPeriodicHandlerDoEffectCalcPeriodic
 
HookList< EffectCalcSpellModHandlerDoEffectCalcSpellMod
 
HookList< EffectAbsorbHandlerOnEffectAbsorb
 
HookList< EffectAbsorbHandlerAfterEffectAbsorb
 
HookList< EffectManaShieldHandlerOnEffectManaShield
 
HookList< EffectManaShieldHandlerAfterEffectManaShield
 
HookList< EffectSplitHandlerOnEffectSplit
 
HookList< CheckProcHandlerDoCheckProc
 
HookList< AfterCheckProcHandlerDoAfterCheckProc
 
HookList< AuraProcHandlerDoPrepareProc
 
HookList< AuraProcHandlerOnProc
 
HookList< AuraProcHandlerAfterProc
 
HookList< EffectProcHandlerOnEffectProc
 
HookList< EffectProcHandlerAfterEffectProc
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CheckProc()

bool spell_dk_dancing_rune_weapon::CheckProc ( ProcEventInfo eventInfo)
inlineprivate
609 {
610 if (!eventInfo.GetActor() || !eventInfo.GetActionTarget() || !eventInfo.GetActionTarget()->IsAlive() || !eventInfo.GetActor()->IsPlayer())
611 return false;
612
613 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
614 if (!spellInfo)
615 return true;
616
617 // Death Coil exception, Check if spell is from spellbook
618 if (spellInfo->Id != SPELL_DK_DEATH_COIL_DAMAGE && !eventInfo.GetActor()->ToPlayer()->HasActiveSpell(spellInfo->Id))
619 return false;
620
621 // Can't cast raise dead/ally, death grip, dark command, death pact, death and decay, anti-magic shell
622 if (spellInfo->SpellFamilyFlags.HasFlag(0x20A1220, 0x10000000, 0x0))
623 return false;
624
625 // AoE can be cast only once
626 if (spellInfo->IsTargetingArea() && eventInfo.GetActor() != eventInfo.GetActionTarget())
627 return false;
628
629 // No spells with summoning
630 if (spellInfo->HasEffect(SPELL_EFFECT_SUMMON))
631 return false;
632
633 // No Positive Spells
634 if (spellInfo->IsPositive())
635 return false;
636
637 return true;
638 }
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:806
bool IsPlayer() const
Definition Object.h:201
Player * ToPlayer()
Definition Object.h:202
bool HasActiveSpell(uint32 spell) const
Definition Player.cpp:3890
Unit * GetActionTarget() const
Definition Unit.h:441
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:185
Unit * GetActor()
Definition Unit.h:440
Definition SpellInfo.h:316
flag96 SpellFamilyFlags
Definition SpellInfo.h:388
uint32 Id
Definition SpellInfo.h:320
bool HasEffect(SpellEffects effect) const
Definition SpellInfo.cpp:876
bool IsPositive() const
Definition SpellInfo.cpp:1237
bool IsTargetingArea() const
Definition SpellInfo.cpp:1025
bool IsAlive() const
Definition Unit.h:1698
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition Util.h:468
@ SPELL_DK_DEATH_COIL_DAMAGE
Definition spell_dk.cpp:51

References ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), ProcEventInfo::GetSpellInfo(), Player::HasActiveSpell(), SpellInfo::HasEffect(), flag96::HasFlag(), SpellInfo::Id, Unit::IsAlive(), Object::IsPlayer(), SpellInfo::IsPositive(), SpellInfo::IsTargetingArea(), SPELL_DK_DEATH_COIL_DAMAGE, SPELL_EFFECT_SUMMON, SpellInfo::SpellFamilyFlags, and Object::ToPlayer().

Referenced by Register().

◆ HandleProc()

void spell_dk_dancing_rune_weapon::HandleProc ( AuraEffect const *  aurEff,
ProcEventInfo eventInfo 
)
inlineprivate
641 {
643
644 Unit* player = eventInfo.GetActor();
645 Unit* target = eventInfo.GetActionTarget();
646 Unit* dancingRuneWeapon = nullptr;
647 for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
648 if (int32((*itr)->GetEntry()) == GetSpellInfo()->Effects[EFFECT_0].MiscValue)
649 {
650 dancingRuneWeapon = *itr;
651 break;
652 }
653
654 if (!dancingRuneWeapon)
655 return;
656
657 dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target));
658 if (SpellInfo const* procSpell = eventInfo.GetSpellInfo())
659 {
660 // xinef: ugly hack
661 if (!procSpell->IsAffectingArea())
663 dancingRuneWeapon->CastSpell(target, procSpell->Id, true, nullptr, aurEff, dancingRuneWeapon->GetGUID());
665 }
666 else if (eventInfo.GetDamageInfo())
667 {
668 target = player->GetMeleeHitRedirectTarget(target);
669 CalcDamageInfo damageInfo;
670 player->CalculateMeleeDamage(target, &damageInfo, eventInfo.GetDamageInfo()->GetAttackType());
671 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
672 {
673 Unit::DealDamageMods(target, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
674 damageInfo.damages[i].damage /= 2.0f;
675 }
676 damageInfo.attacker = dancingRuneWeapon;
677 dancingRuneWeapon->SendAttackStateUpdate(&damageInfo);
678 dancingRuneWeapon->DealMeleeDamage(&damageInfo, true);
679 }
680 }
std::int32_t int32
Definition Define.h:103
std::uint8_t uint8
Definition Define.h:109
#define MAX_ITEM_PROTO_DAMAGES
Definition ItemTemplate.h:613
@ EFFECT_0
Definition SharedDefines.h:31
@ UNIT_FIELD_COMBATREACH
Definition UpdateFields.h:123
void PreventDefaultAction()
Definition SpellScript.cpp:985
SpellInfo const * GetSpellInfo() const
Definition SpellScript.cpp:1005
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1030
WeaponAttackType GetAttackType() const
Definition Unit.h:364
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:737
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
DamageInfo * GetDamageInfo() const
Definition Unit.h:450
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
Definition Unit.h:620
ControlSet m_Controlled
Definition Unit.h:1981
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition Unit.cpp:6535
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:11101
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1179
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition Unit.cpp:1476
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition Unit.cpp:1841
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:801
Definition Unit.h:464
uint32 absorb
Definition Unit.h:472
struct CalcDamageInfo::@265 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 damage
Definition Unit.h:471
Unit * attacker
Definition Unit.h:465
void SetOrientation(float orientation)
Definition Position.h:116
float GetAngle(const Position *pos) const
Definition Position.cpp:78

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, Unit::CalculateMeleeDamage(), Unit::CastSpell(), CalcDamageInfo::damage, CalcDamageInfo::damages, Unit::DealDamageMods(), Unit::DealMeleeDamage(), EFFECT_0, SpellInfo::Effects, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), Position::GetAngle(), DamageInfo::GetAttackType(), ProcEventInfo::GetDamageInfo(), Object::GetGUID(), Unit::GetMeleeHitRedirectTarget(), ProcEventInfo::GetSpellInfo(), AuraScript::GetSpellInfo(), AuraScript::GetUnitOwner(), Unit::m_Controlled, MAX_ITEM_PROTO_DAMAGES, AuraScript::PreventDefaultAction(), Unit::SendAttackStateUpdate(), Object::SetFloatValue(), Position::SetOrientation(), and UNIT_FIELD_COMBATREACH.

Referenced by Register().

◆ PrepareAuraScript()

spell_dk_dancing_rune_weapon::PrepareAuraScript ( spell_dk_dancing_rune_weapon  )
private

◆ Register()

void spell_dk_dancing_rune_weapon::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

683 {
686 }
@ EFFECT_1
Definition SharedDefines.h:32
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
#define AuraEffectProcFn(F, I, N)
Definition SpellScript.h:847
#define AuraCheckProcFn(F)
Definition SpellScript.h:818
HookList< CheckProcHandler > DoCheckProc
Definition SpellScript.h:817
HookList< EffectProcHandler > OnEffectProc
Definition SpellScript.h:842
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition spell_dk.cpp:640
bool CheckProc(ProcEventInfo &eventInfo)
Definition spell_dk.cpp:608

References AuraCheckProcFn, AuraEffectProcFn, CheckProc(), AuraScript::DoCheckProc, EFFECT_1, HandleProc(), AuraScript::OnEffectProc, and SPELL_AURA_DUMMY.


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