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 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 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
 
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

◆ CheckProc()

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

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
640 {
642
643 Unit* player = eventInfo.GetActor();
644 Unit* target = eventInfo.GetActionTarget();
645 Unit* dancingRuneWeapon = nullptr;
646 for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
647 if (int32((*itr)->GetEntry()) == GetSpellInfo()->Effects[EFFECT_0].MiscValue)
648 {
649 dancingRuneWeapon = *itr;
650 break;
651 }
652
653 if (!dancingRuneWeapon)
654 return;
655
656 dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target));
657 if (SpellInfo const* procSpell = eventInfo.GetSpellInfo())
658 {
659 // xinef: ugly hack
660 if (!procSpell->IsAffectingArea())
662 dancingRuneWeapon->CastSpell(target, procSpell->Id, true, nullptr, aurEff, dancingRuneWeapon->GetGUID());
664 }
665 else if (eventInfo.GetDamageInfo())
666 {
667 target = player->GetMeleeHitRedirectTarget(target);
668 CalcDamageInfo damageInfo;
669 player->CalculateMeleeDamage(target, &damageInfo, eventInfo.GetDamageInfo()->GetAttackType());
670 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
671 {
672 Unit::DealDamageMods(target, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
673 damageInfo.damages[i].damage /= 2.0f;
674 }
675 damageInfo.attacker = dancingRuneWeapon;
676 dancingRuneWeapon->SendAttackStateUpdate(&damageInfo);
677 dancingRuneWeapon->DealMeleeDamage(&damageInfo, true);
678 }
679 }
std::int32_t int32
Definition: Define.h:103
std::uint8_t uint8
Definition: Define.h:109
@ EFFECT_0
Definition: SharedDefines.h:31
#define MAX_ITEM_PROTO_DAMAGES
Definition: ItemTemplate.h:613
@ UNIT_FIELD_COMBATREACH
Definition: UpdateFields.h:123
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:737
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
void SetOrientation(float orientation)
Definition: Position.h:111
float GetAngle(const Position *pos) const
Definition: Position.cpp:78
WeaponAttackType GetAttackType() const
Definition: Unit.h:363
DamageInfo * GetDamageInfo() const
Definition: Unit.h:449
Definition: Unit.h:463
struct CalcDamageInfo::@264 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 absorb
Definition: Unit.h:471
uint32 damage
Definition: Unit.h:470
Unit * attacker
Definition: Unit.h:464
Definition: Unit.h:630
ControlSet m_Controlled
Definition: Unit.h:1940
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition: Unit.cpp:6479
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition: Unit.cpp:11057
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:1167
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition: Unit.cpp:1464
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1829
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:800
void PreventDefaultAction()
Definition: SpellScript.cpp:985
SpellInfo const * GetSpellInfo() const
Definition: SpellScript.cpp:1005
Unit * GetUnitOwner() const
Definition: SpellScript.cpp:1030

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, Unit::CalculateMeleeDamage(), Unit::CastSpell(), CalcDamageInfo::damage, CalcDamageInfo::damages, Unit::DealDamageMods(), Unit::DealMeleeDamage(), EFFECT_0, 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.

682 {
685 }
@ EFFECT_1
Definition: SharedDefines.h:32
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:847
#define AuraCheckProcFn(F)
Definition: SpellScript.h:818
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67
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:639
bool CheckProc(ProcEventInfo &eventInfo)
Definition: spell_dk.cpp:607

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