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
619 {
620 if (!eventInfo.GetActor() || !eventInfo.GetActionTarget() || !eventInfo.GetActionTarget()->IsAlive() || !eventInfo.GetActor()->IsPlayer())
621 return false;
622
623 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
624 if (!spellInfo)
625 return true;
626
627 // Death Coil exception, Check if spell is from spellbook
628 if (spellInfo->Id != SPELL_DK_DEATH_COIL_DAMAGE && !eventInfo.GetActor()->ToPlayer()->HasActiveSpell(spellInfo->Id))
629 return false;
630
631 // Can't cast raise dead/ally, death grip, dark command, death pact, death and decay, anti-magic shell
632 if (spellInfo->SpellFamilyFlags.HasFlag(0x20A1220, 0x10000000, 0x0))
633 return false;
634
635 // AoE can be cast only once
636 if (spellInfo->IsTargetingArea() && eventInfo.GetActor() != eventInfo.GetActionTarget())
637 return false;
638
639 // No spells with summoning
640 if (spellInfo->HasEffect(SPELL_EFFECT_SUMMON))
641 return false;
642
643 // No Positive Spells
644 if (spellInfo->IsPositive())
645 return false;
646
647 return true;
648 }
@ 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
651 {
653
654 Unit* player = eventInfo.GetActor();
655 Unit* target = eventInfo.GetActionTarget();
656 Unit* dancingRuneWeapon = nullptr;
657 for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
658 if (int32((*itr)->GetEntry()) == GetSpellInfo()->Effects[EFFECT_0].MiscValue)
659 {
660 dancingRuneWeapon = *itr;
661 break;
662 }
663
664 if (!dancingRuneWeapon)
665 return;
666
667 dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target));
668 if (SpellInfo const* procSpell = eventInfo.GetSpellInfo())
669 {
670 // xinef: ugly hack
671 if (!procSpell->IsAffectingArea())
673 dancingRuneWeapon->CastSpell(target, procSpell->Id, true, nullptr, aurEff, dancingRuneWeapon->GetGUID());
675 }
676 else if (eventInfo.GetDamageInfo())
677 {
678 target = player->GetMeleeHitRedirectTarget(target);
679 CalcDamageInfo damageInfo;
680 player->CalculateMeleeDamage(target, &damageInfo, eventInfo.GetDamageInfo()->GetAttackType());
681 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
682 {
683 Unit::DealDamageMods(target, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
684 damageInfo.damages[i].damage /= 2.0f;
685 }
686 damageInfo.attacker = dancingRuneWeapon;
687 dancingRuneWeapon->SendAttackStateUpdate(&damageInfo);
688 dancingRuneWeapon->DealMeleeDamage(&damageInfo, true);
689 }
690 }
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.

693 {
696 }
@ 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:650
bool CheckProc(ProcEventInfo &eventInfo)
Definition spell_dk.cpp:618

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: