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
1253 {
1254 if (IsTargetValid(eventInfo.GetSpellInfo(), eventInfo.GetProcTarget()))
1255 {
1256 Unit* caster = eventInfo.GetActor();
1257 caster->CastSpell(caster, SPELL_LOCK_AND_LOAD_MARKER, true);
1258 }
1259 }
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:184
Unit * GetActor()
Definition Unit.h:439
Unit * GetProcTarget() const
Definition Unit.h:441
Definition Unit.h:636
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:1178
bool IsTargetValid(SpellInfo const *spellInfo, Unit *target)
Definition spell_hunter.cpp:1193
@ SPELL_LOCK_AND_LOAD_MARKER
Definition spell_hunter.cpp:72

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
1176 {
1177 SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
1178 if (!spellInfo || !eventInfo.GetActor())
1179 {
1180 return false;
1181 }
1182
1183 // Black Arrow and Fire traps may trigger on periodic tick only.
1184 if (((spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FIRE) || (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_SHADOW))
1185 && (spellInfo->Effects[0].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || spellInfo->Effects[1].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE))
1186 {
1187 return true;
1188 }
1189
1190 return IsTargetValid(spellInfo, eventInfo.GetProcTarget()) && !eventInfo.GetActor()->HasAura(SPELL_LOCK_AND_LOAD_MARKER);
1191 }
@ 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:1987
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:5753

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

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

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.

1262 {
1264
1265 OnEffectProc += AuraEffectProcFn(spell_hun_lock_and_load::HandleProcs<PROC_FLAG_DONE_TRAP_ACTIVATION>, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
1266 OnEffectProc += AuraEffectProcFn(spell_hun_lock_and_load::HandleProcs<PROC_FLAG_DONE_PERIODIC>, EFFECT_1, SPELL_AURA_DUMMY);
1267
1269 }
@ 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:1175
void ApplyMarker(ProcEventInfo &eventInfo)
Definition spell_hunter.cpp:1252

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.

1171 {
1173 }
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: