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

Private Member Functions

 PrepareSpellScript (spell_hun_chimera_shot)
 
bool Validate (SpellInfo const *) override
 
void HandleScriptEffect (SpellEffIndex)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- 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 SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ HandleScriptEffect()

void spell_hun_chimera_shot::HandleScriptEffect ( SpellEffIndex  )
inlineprivate
459 {
460 Unit* caster = GetCaster();
461 if (Unit* unitTarget = GetHitUnit())
462 {
463 uint32 spellId = 0;
464 int32 basePoint = 0;
465 Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
466 for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
467 {
468 Aura* aura = i->second->GetBase();
469 if (aura->GetCasterGUID() != caster->GetGUID())
470 continue;
471
472 // Search only Serpent Sting, Viper Sting, Scorpid Sting auras
473 flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
474 if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
475 continue;
476 if (AuraEffect* aurEff = aura->GetEffect(0))
477 {
478 // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
479 if (familyFlag[0] & 0x4000)
480 {
481 int32 TickCount = aurEff->GetTotalTicks();
483 basePoint = aurEff->GetAmount();
484 ApplyPct(basePoint, TickCount * 40);
485 basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
486 }
487 // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
488 else if (familyFlag[1] & 0x00000080)
489 {
490 int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
492
493 // Amount of one aura tick
494 basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
495 int32 casterBasePoint = aurEff->GetAmount() * caster->GetMaxPower(POWER_MANA) / 50;
496 if (basePoint > casterBasePoint)
497 basePoint = casterBasePoint;
498 ApplyPct(basePoint, TickCount * 60);
499 }
500 // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
501 else if (familyFlag[0] & 0x00008000)
502 {
503 if (caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
504 {
506 break;
507
509 }
510
512 }
513
514 // Refresh aura duration
515 aura->RefreshDuration();
516 aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false);
517 }
518 break;
519 }
520
521 if (spellId)
522 caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
523 }
524 }
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
@ POWER_MANA
Definition SharedDefines.h:257
@ DOT
Definition Unit.h:256
T ApplyPct(T &base, U pct)
Definition Util.h:64
T CalculatePct(T base, U pct)
Definition Util.h:52
Definition SpellAuraEffects.h:39
int32 GetTotalTicks() const
Definition SpellAuraEffects.cpp:7058
Definition SpellAuras.h:87
void RefreshDuration(bool withMods=false)
Definition SpellAuras.cpp:822
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:105
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:176
uint8 GetStackAmount() const
Definition SpellAuras.h:148
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:100
Player * ToPlayer()
Definition Object.h:202
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:114
bool HasSpellCooldown(uint32 spell_id) const override
Definition Player.cpp:16350
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11006
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
Unit * GetHitUnit()
Definition SpellScript.cpp:448
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:664
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:673
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1407
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1136
Definition Util.h:442
@ SPELL_HUNTER_CHIMERA_SHOT_SCORPID
Definition spell_hunter.cpp:49
@ SPELL_HUNTER_CHIMERA_SHOT_VIPER
Definition spell_hunter.cpp:48
@ SPELL_HUNTER_CHIMERA_SHOT_SERPENT
Definition spell_hunter.cpp:47

References Player::AddSpellCooldown(), ApplyPct(), CalculatePct(), Unit::CastCustomSpell(), DOT, SpellScript::GetCaster(), Aura::GetCasterGUID(), Aura::GetEffect(), Object::GetGUID(), SpellScript::GetHitUnit(), Unit::GetMaxPower(), Aura::GetSpellInfo(), Aura::GetStackAmount(), AuraEffect::GetTotalTicks(), Player::HasSpellCooldown(), POWER_MANA, Aura::RefreshDuration(), SPELL_HUNTER_CHIMERA_SHOT_SCORPID, SPELL_HUNTER_CHIMERA_SHOT_SERPENT, SPELL_HUNTER_CHIMERA_SHOT_VIPER, SpellInfo::SpellFamilyFlags, and Object::ToPlayer().

Referenced by Register().

◆ PrepareSpellScript()

spell_hun_chimera_shot::PrepareSpellScript ( spell_hun_chimera_shot  )
private

◆ Register()

void spell_hun_chimera_shot::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

527 {
529 }
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_EFFECT_SCRIPT_EFFECT
Definition SharedDefines.h:843
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
HookList< EffectHandler > OnEffectHitTarget
Definition SpellScript.h:336
void HandleScriptEffect(SpellEffIndex)
Definition spell_hunter.cpp:458

References EFFECT_0, HandleScriptEffect(), SpellScript::OnEffectHitTarget, SPELL_EFFECT_SCRIPT_EFFECT, and SpellEffectFn.

◆ Validate()

bool spell_hun_chimera_shot::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

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