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

Private Member Functions

 PrepareAuraScript (spell_hun_lock_and_load)
 
bool Validate (SpellInfo const *) override
 
bool CheckTrapProc (ProcEventInfo &eventInfo)
 
bool IsTargetValid (SpellInfo const *spellInfo, Unit *target)
 
template<uint32 mask>
void HandleProcs (AuraEffect const *aurEff, ProcEventInfo &eventInfo)
 
void ApplyMarker (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 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

◆ ApplyMarker()

void spell_hun_lock_and_load::ApplyMarker ( ProcEventInfo eventInfo)
inlineprivate
1251 {
1252 if (IsTargetValid(eventInfo.GetSpellInfo(), eventInfo.GetProcTarget()))
1253 {
1254 Unit* caster = eventInfo.GetActor();
1255 caster->CastSpell(caster, SPELL_LOCK_AND_LOAD_MARKER, true);
1256 }
1257 }
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:185
Unit * GetActor()
Definition Unit.h:440
Unit * GetProcTarget() const
Definition Unit.h:442
Definition Unit.h:620
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:1193
bool IsTargetValid(SpellInfo const *spellInfo, Unit *target)
Definition spell_hunter.cpp:1191
@ SPELL_LOCK_AND_LOAD_MARKER
Definition spell_hunter.cpp:69

References Unit::CastSpell(), ProcEventInfo::GetActor(), ProcEventInfo::GetProcTarget(), ProcEventInfo::GetSpellInfo(), IsTargetValid(), and SPELL_LOCK_AND_LOAD_MARKER.

Referenced by Register().

◆ CheckTrapProc()

bool spell_hun_lock_and_load::CheckTrapProc ( ProcEventInfo eventInfo)
inlineprivate
1174 {
1175 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1176 if (!spellInfo || !eventInfo.GetActor())
1177 {
1178 return false;
1179 }
1180
1181 // Black Arrow and Fire traps may trigger on periodic tick only.
1182 if (((spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FIRE) || (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_SHADOW))
1183 && (spellInfo->Effects[0].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || spellInfo->Effects[1].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE))
1184 {
1185 return true;
1186 }
1187
1188 return IsTargetValid(spellInfo, eventInfo.GetProcTarget()) && !eventInfo.GetActor()->HasAura(SPELL_LOCK_AND_LOAD_MARKER);
1189 }
@ SPELL_SCHOOL_MASK_SHADOW
Definition SharedDefines.h:302
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:299
@ SPELL_AURA_PERIODIC_DAMAGE
Definition SpellAuraDefines.h:66
Definition SpellInfo.h:316
SpellSchoolMask GetSchoolMask() const
Definition SpellInfo.cpp:1998
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:393
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5777

References SpellInfo::Effects, ProcEventInfo::GetActor(), ProcEventInfo::GetProcTarget(), SpellInfo::GetSchoolMask(), ProcEventInfo::GetSpellInfo(), Unit::HasAura(), IsTargetValid(), SPELL_AURA_PERIODIC_DAMAGE, SPELL_LOCK_AND_LOAD_MARKER, SPELL_SCHOOL_MASK_FIRE, and SPELL_SCHOOL_MASK_SHADOW.

Referenced by Register().

◆ HandleProcs()

template<uint32 mask>
void spell_hun_lock_and_load::HandleProcs ( AuraEffect const *  aurEff,
ProcEventInfo eventInfo 
)
inlineprivate
1222 {
1224
1225 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1226
1227 if (!(eventInfo.GetTypeMask() & mask) || !spellInfo)
1228 {
1229 return;
1230 }
1231
1232 // Also check if the proc from the fire traps and black arrow actually comes from the periodic ticks here.
1233 // Normally this wouldn't be required, but we are circumventing the current proc system limitations.
1234 if (((spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FIRE) || (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_SHADOW))
1235 && (spellInfo->Effects[0].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || spellInfo->Effects[1].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE)
1236 && !(mask & PROC_FLAG_DONE_PERIODIC))
1237 {
1238 return;
1239 }
1240
1241 if (!roll_chance_i(aurEff->GetAmount()))
1242 {
1243 return;
1244 }
1245
1246 Unit* caster = eventInfo.GetActor();
1247 caster->CastSpell(caster, SPELL_LOCK_AND_LOAD_TRIGGER, true);
1248 }
bool roll_chance_i(int chance)
Definition Random.h:63
@ PROC_FLAG_DONE_PERIODIC
Definition SpellMgr.h:134
void PreventDefaultAction()
Definition SpellScript.cpp:985
uint32 GetTypeMask() const
Definition Unit.h:443
@ SPELL_LOCK_AND_LOAD_TRIGGER
Definition spell_hunter.cpp:68

References Unit::CastSpell(), SpellInfo::Effects, ProcEventInfo::GetActor(), AuraEffect::GetAmount(), SpellInfo::GetSchoolMask(), ProcEventInfo::GetSpellInfo(), ProcEventInfo::GetTypeMask(), AuraScript::PreventDefaultAction(), PROC_FLAG_DONE_PERIODIC, roll_chance_i(), SPELL_AURA_PERIODIC_DAMAGE, SPELL_LOCK_AND_LOAD_TRIGGER, SPELL_SCHOOL_MASK_FIRE, and SPELL_SCHOOL_MASK_SHADOW.

◆ IsTargetValid()

bool spell_hun_lock_and_load::IsTargetValid ( SpellInfo const *  spellInfo,
Unit target 
)
inlineprivate
1192 {
1193 if (!spellInfo || !target)
1194 {
1195 return false;
1196 }
1197
1198 // Don't check it for fire traps and black arrow, they proc on periodic only and not spell hit.
1199 // So it's wrong to check for immunity, it was already checked when the spell was applied.
1200 if ((spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FIRE) || (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_SHADOW))
1201 {
1202 return false;
1203 }
1204
1205 // HitMask for Frost Trap can't be checked correctly as it is.
1206 // That's because the talent is triggered by the spell that fires the trap (63487)...
1207 // ...and not the actual spell that applies the slow effect (67035).
1208 // So the IMMUNE result is never sent by the spell that triggers this.
1209 if (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_NATURE)
1210 {
1211 if (SpellInfo const* triggerSpell = sSpellMgr->GetSpellInfo(SPELL_FROST_TRAP_SLOW))
1212 {
1213 return !target->IsImmunedToSpell(triggerSpell);
1214 }
1215 }
1216
1217 return true;
1218 }
@ SPELL_SCHOOL_MASK_NATURE
Definition SharedDefines.h:300
#define sSpellMgr
Definition SpellMgr.h:825
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition Unit.cpp:13001
@ SPELL_FROST_TRAP_SLOW
Definition spell_hunter.cpp:1160

References SpellInfo::GetSchoolMask(), Unit::IsImmunedToSpell(), SPELL_FROST_TRAP_SLOW, SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_NATURE, SPELL_SCHOOL_MASK_SHADOW, and sSpellMgr.

Referenced by ApplyMarker(), and CheckTrapProc().

◆ PrepareAuraScript()

spell_hun_lock_and_load::PrepareAuraScript ( spell_hun_lock_and_load  )
private

◆ Register()

void spell_hun_lock_and_load::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1260 {
1262
1263 OnEffectProc += AuraEffectProcFn(spell_hun_lock_and_load::HandleProcs<PROC_FLAG_DONE_TRAP_ACTIVATION>, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
1264 OnEffectProc += AuraEffectProcFn(spell_hun_lock_and_load::HandleProcs<PROC_FLAG_DONE_PERIODIC>, EFFECT_1, SPELL_AURA_DUMMY);
1265
1267 }
@ EFFECT_1
Definition SharedDefines.h:32
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition SpellAuraDefines.h:105
@ SPELL_AURA_DUMMY
Definition SpellAuraDefines.h:67
#define AuraProcFn(F)
Definition SpellScript.h:837
#define AuraEffectProcFn(F, I, N)
Definition SpellScript.h:847
#define AuraCheckProcFn(F)
Definition SpellScript.h:818
HookList< AuraProcHandler > AfterProc
Definition SpellScript.h:836
HookList< CheckProcHandler > DoCheckProc
Definition SpellScript.h:817
HookList< EffectProcHandler > OnEffectProc
Definition SpellScript.h:842
bool CheckTrapProc(ProcEventInfo &eventInfo)
Definition spell_hunter.cpp:1173
void ApplyMarker(ProcEventInfo &eventInfo)
Definition spell_hunter.cpp:1250

References AuraScript::AfterProc, ApplyMarker(), AuraCheckProcFn, AuraEffectProcFn, AuraProcFn, CheckTrapProc(), AuraScript::DoCheckProc, EFFECT_0, EFFECT_1, AuraScript::OnEffectProc, SPELL_AURA_DUMMY, and SPELL_AURA_PROC_TRIGGER_SPELL.

◆ Validate()

bool spell_hun_lock_and_load::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

1169 {
1171 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition SpellScript.h:125

References SPELL_FROST_TRAP_SLOW, SPELL_LOCK_AND_LOAD_MARKER, SPELL_LOCK_AND_LOAD_TRIGGER, and _SpellScript::ValidateSpellInfo().


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