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
 
GameObject * GetGObjCaster () 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< 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
667 {
668 if (!eventInfo.GetActor() || !eventInfo.GetActionTarget() || !eventInfo.GetActionTarget()->IsAlive() || !eventInfo.GetActor()->IsPlayer())
669 return false;
670
671 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
672 if (!spellInfo)
673 return true;
674
675 // Death Coil exception, Check if spell is from spellbook
676 if (spellInfo->Id != SPELL_DK_DEATH_COIL_DAMAGE && !eventInfo.GetActor()->ToPlayer()->HasActiveSpell(spellInfo->Id))
677 return false;
678
679 // Can't cast raise dead/ally, death grip, dark command, death pact, death and decay, anti-magic shell
680 if (spellInfo->SpellFamilyFlags.HasFlag(0x20A1220, 0x10000000, 0x0))
681 return false;
682
683 // AoE can be cast only once
684 if (spellInfo->IsTargetingArea() && eventInfo.GetActor() != eventInfo.GetActionTarget())
685 return false;
686
687 // No spells with summoning
688 if (spellInfo->HasEffect(SPELL_EFFECT_SUMMON))
689 return false;
690
691 // No Positive Spells
692 if (spellInfo->IsPositive())
693 return false;
694
695 return true;
696 }
@ 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:4072
Unit * GetActionTarget() const
Definition Unit.h:469
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:301
Unit * GetActor()
Definition Unit.h:468
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:1812
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
653 {
654 Unit* caster = GetCaster();
655 if (!caster)
656 return;
657
658 // Redirect 100% of the DRW's threat to the DK player
659 uint32 npcEntry = GetSpellInfo()->Effects[EFFECT_0].MiscValue;
660 std::list<Creature*> runeWeapons;
661 caster->GetAllMinionsByEntry(runeWeapons, npcEntry);
662 for (Creature* temp : runeWeapons)
663 temp->GetThreatMgr().RegisterRedirectThreat(GetId(), caster->GetGUID(), 100);
664 }
std::uint32_t uint32
Definition Define.h:107
@ EFFECT_0
Definition SharedDefines.h:31
SpellInfo const * GetSpellInfo() const
Definition SpellScript.cpp:1011
Unit * GetCaster() const
Definition SpellScript.cpp:1026
uint32 GetId() const
Definition SpellScript.cpp:1016
Definition Creature.h:47
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
Definition Unit.h:670
void GetAllMinionsByEntry(std::list< Creature * > &Minions, uint32 entry)
Definition Unit.cpp:7768

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
699 {
701
702 Unit* player = eventInfo.GetActor();
703 Unit* target = eventInfo.GetActionTarget();
704 Unit* dancingRuneWeapon = nullptr;
705 for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
706 if (int32((*itr)->GetEntry()) == GetSpellInfo()->Effects[EFFECT_0].MiscValue)
707 {
708 dancingRuneWeapon = *itr;
709 break;
710 }
711
712 if (!dancingRuneWeapon)
713 return;
714
715 dancingRuneWeapon->SetOrientation(dancingRuneWeapon->GetAngle(target));
716 if (SpellInfo const* procSpell = eventInfo.GetSpellInfo())
717 {
718 // xinef: ugly hack
719 if (!procSpell->IsAffectingArea())
721 dancingRuneWeapon->CastSpell(target, procSpell->Id, true, nullptr, aurEff, dancingRuneWeapon->GetGUID());
723 }
724 else if (eventInfo.GetDamageInfo())
725 {
726 target = player->GetMeleeHitRedirectTarget(target);
727 CalcDamageInfo damageInfo;
728 player->CalculateMeleeDamage(target, &damageInfo, eventInfo.GetDamageInfo()->GetAttackType());
729 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
730 {
731 Unit::DealDamageMods(target, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
732 damageInfo.damages[i].damage /= 2.0f;
733 }
734 damageInfo.attacker = dancingRuneWeapon;
735 dancingRuneWeapon->SendAttackStateUpdate(&damageInfo);
736 dancingRuneWeapon->DealMeleeDamage(&damageInfo, true);
737 }
738 }
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:991
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1043
WeaponAttackType GetAttackType() const
Definition Unit.h:380
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:478
ControlSet m_Controlled
Definition Unit.h:2095
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition Unit.cpp:6700
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition Unit.cpp:7979
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:1378
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition Unit.cpp:1684
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition Unit.cpp:2024
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition Unit.cpp:980
Definition Unit.h:489
struct CalcDamageInfo::@271 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 absorb
Definition Unit.h:497
uint32 damage
Definition Unit.h:496
Unit * attacker
Definition Unit.h:490
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.

741 {
745 }
@ 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:851
#define AuraEffectApplyFn(F, I, N, M)
Definition SpellScript.h:744
#define AuraCheckProcFn(F)
Definition SpellScript.h:820
HookList< EffectApplyHandler > AfterEffectApply
Definition SpellScript.h:743
HookList< CheckProcHandler > DoCheckProc
Definition SpellScript.h:819
HookList< EffectProcHandler > OnEffectProc
Definition SpellScript.h:846
void HandleApply(AuraEffect const *, AuraEffectHandleModes)
Definition spell_dk.cpp:652
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
Definition spell_dk.cpp:698
bool CheckProc(ProcEventInfo &eventInfo)
Definition spell_dk.cpp:666

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: