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)
 
void HandleApply (AuraEffect const *, AuraEffectHandleModes)
 
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
 
Unit * GetCaster () const
 
WorldObject * GetOwner () const
 
Unit * GetUnitOwner () const
 
DynamicObject * GetDynobjOwner () const
 
void Remove (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
Aura * GetAura () 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
 
AuraEffect * GetEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
Unit * GetTarget () 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< CheckAreaTargetHandler > DoCheckAreaTarget
 
HookList< AuraDispelHandler > OnDispel
 
HookList< AuraDispelHandler > AfterDispel
 
HookList< EffectApplyHandler > OnEffectApply
 
HookList< EffectApplyHandler > AfterEffectApply
 
HookList< EffectApplyHandler > OnEffectRemove
 
HookList< EffectApplyHandler > AfterEffectRemove
 
HookList< EffectPeriodicHandler > OnEffectPeriodic
 
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
 
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
 
HookList< EffectCalcSpellModHandler > DoEffectCalcSpellMod
 
HookList< EffectAbsorbHandler > OnEffectAbsorb
 
HookList< EffectAbsorbHandler > AfterEffectAbsorb
 
HookList< EffectManaShieldHandler > OnEffectManaShield
 
HookList< EffectManaShieldHandler > AfterEffectManaShield
 
HookList< EffectSplitHandler > OnEffectSplit
 
HookList< CheckProcHandler > DoCheckProc
 
HookList< CheckEffectProcHandler > DoCheckEffectProc
 
HookList< AfterCheckProcHandler > DoAfterCheckProc
 
HookList< AuraProcHandler > DoPrepareProc
 
HookList< AuraProcHandler > OnProc
 
HookList< AuraProcHandler > AfterProc
 
HookList< EffectProcHandler > OnEffectProc
 
HookList< EffectProcHandler > AfterEffectProc
 
- 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
665 {
666 if (!eventInfo.GetActor() || !eventInfo.GetActionTarget() || !eventInfo.GetActionTarget()->IsAlive() || !eventInfo.GetActor()->IsPlayer())
667 return false;
668
669 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
670 if (!spellInfo)
671 return true;
672
673 // Death Coil exception, Check if spell is from spellbook
674 if (spellInfo->Id != SPELL_DK_DEATH_COIL_DAMAGE && !eventInfo.GetActor()->ToPlayer()->HasActiveSpell(spellInfo->Id))
675 return false;
676
677 // Can't cast raise dead/ally, death grip, dark command, death pact, death and decay, anti-magic shell
678 if (spellInfo->SpellFamilyFlags.HasFlag(0x20A1220, 0x10000000, 0x0))
679 return false;
680
681 // AoE can be cast only once
682 if (spellInfo->IsTargetingArea() && eventInfo.GetActor() != eventInfo.GetActionTarget())
683 return false;
684
685 // No spells with summoning
686 if (spellInfo->HasEffect(SPELL_EFFECT_SUMMON))
687 return false;
688
689 // No Positive Spells
690 if (spellInfo->IsPositive())
691 return false;
692
693 return true;
694 }
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:794
bool IsPlayer() const
Definition Object.h:207
Player * ToPlayer()
Definition Object.h:208
bool HasActiveSpell(uint32 spell) const
Definition Player.cpp:4063
Unit * GetActionTarget() const
Definition Unit.h:463
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:301
Unit * GetActor()
Definition Unit.h:462
Definition SpellInfo.h:340
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
uint32 Id
Definition SpellInfo.h:344
bool HasEffect(SpellEffects effect) const
Definition SpellInfo.cpp:889
bool IsPositive() const
Definition SpellInfo.cpp:1282
bool IsTargetingArea() const
Definition SpellInfo.cpp:1070
bool IsAlive() const
Definition Unit.h:1798
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition Util.h:459
@ SPELL_DK_DEATH_COIL_DAMAGE
Definition spell_dk.cpp:50

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().

◆ HandleApply()

void spell_dk_dancing_rune_weapon::HandleApply ( AuraEffect const *  ,
AuraEffectHandleModes   
)
inlineprivate
651 {
652 Unit* caster = GetCaster();
653 if (!caster)
654 return;
655
656 // Redirect 100% of the DRW's threat to the DK player
657 uint32 npcEntry = GetSpellInfo()->Effects[EFFECT_0].MiscValue;
658 std::list<Creature*> runeWeapons;
659 caster->GetAllMinionsByEntry(runeWeapons, npcEntry);
660 for (Creature* temp : runeWeapons)
661 temp->GetThreatMgr().RegisterRedirectThreat(GetId(), caster->GetGUID(), 100);
662 }
std::uint32_t uint32
Definition Define.h:107
@ EFFECT_0
Definition SharedDefines.h:31
SpellInfo const * GetSpellInfo() const
Definition SpellScript.cpp:1025
Unit * GetCaster() const
Definition SpellScript.cpp:1040
uint32 GetId() const
Definition SpellScript.cpp:1030
Definition Creature.h:47
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
Definition Unit.h:667
void GetAllMinionsByEntry(std::list< Creature * > &Minions, uint32 entry)
Definition Unit.cpp:7738

References EFFECT_0, SpellInfo::Effects, Unit::GetAllMinionsByEntry(), AuraScript::GetCaster(), Object::GetGUID(), AuraScript::GetId(), and AuraScript::GetSpellInfo().

Referenced by Register().

◆ HandleProc()

void spell_dk_dancing_rune_weapon::HandleProc ( AuraEffect const *  aurEff,
ProcEventInfo &  eventInfo 
)
inlineprivate
697 {
699
700 Unit* player = eventInfo.GetActor();
701 Unit* target = eventInfo.GetActionTarget();
702 Unit* dancingRuneWeapon = nullptr;
703 for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
704 if (int32((*itr)->GetEntry()) == GetSpellInfo()->Effects[EFFECT_0].MiscValue)
705 {
706 dancingRuneWeapon = *itr;
707 break;
708 }
709
710 if (!dancingRuneWeapon)
711 return;
712
713 dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target));
714 if (SpellInfo const* procSpell = eventInfo.GetSpellInfo())
715 {
716 // xinef: ugly hack
717 if (!procSpell->IsAffectingArea())
719 dancingRuneWeapon->CastSpell(target, procSpell->Id, true, nullptr, aurEff, dancingRuneWeapon->GetGUID());
721 }
722 else if (eventInfo.GetDamageInfo())
723 {
724 target = player->GetMeleeHitRedirectTarget(target);
725 CalcDamageInfo damageInfo;
726 player->CalculateMeleeDamage(target, &damageInfo, eventInfo.GetDamageInfo()->GetAttackType());
727 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
728 {
729 Unit::DealDamageMods(target, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
730 damageInfo.damages[i].damage /= 2.0f;
731 }
732 damageInfo.attacker = dancingRuneWeapon;
733 dancingRuneWeapon->SendAttackStateUpdate(&damageInfo);
734 dancingRuneWeapon->DealMeleeDamage(&damageInfo, true);
735 }
736 }
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
@ UNIT_FIELD_COMBATREACH
Definition UpdateFields.h:123
void PreventDefaultAction()
Definition SpellScript.cpp:1005
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1050
WeaponAttackType GetAttackType() const
Definition Unit.h:374
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:735
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
DamageInfo * GetDamageInfo() const
Definition Unit.h:472
ControlSet m_Controlled
Definition Unit.h:2081
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition Unit.cpp:6664
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:7949
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:1372
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition Unit.cpp:1678
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition Unit.cpp:2020
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:980
Definition Unit.h:486
struct CalcDamageInfo::@270 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 absorb
Definition Unit.h:494
uint32 damage
Definition Unit.h:493
Unit * attacker
Definition Unit.h:487
float GetAngle(Position const *pos) const
Definition Position.cpp:85
void SetOrientation(float orientation)
Definition Position.h:116

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.

739 {
743 }
@ EFFECT_1
Definition SharedDefines.h:32
@ EFFECT_2
Definition SharedDefines.h:33
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
#define AuraEffectProcFn(F, I, N)
Definition SpellScript.h:868
#define AuraEffectApplyFn(F, I, N, M)
Definition SpellScript.h:755
#define AuraCheckProcFn(F)
Definition SpellScript.h:831
HookList< EffectApplyHandler > AfterEffectApply
Definition SpellScript.h:754
HookList< CheckProcHandler > DoCheckProc
Definition SpellScript.h:830
HookList< EffectProcHandler > OnEffectProc
Definition SpellScript.h:863
void HandleApply(AuraEffect const *, AuraEffectHandleModes)
Definition spell_dk.cpp:650
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition spell_dk.cpp:696
bool CheckProc(ProcEventInfo &eventInfo)
Definition spell_dk.cpp:664

References AuraScript::AfterEffectApply, AURA_EFFECT_HANDLE_REAL, AuraCheckProcFn, AuraEffectApplyFn, AuraEffectProcFn, CheckProc(), AuraScript::DoCheckProc, EFFECT_1, EFFECT_2, HandleApply(), HandleProc(), AuraScript::OnEffectProc, and SPELL_AURA_DUMMY.


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