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
 
Unit * GetCaster ()
 
GameObject * GetGObjCaster ()
 
Unit * GetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObject * GetExplTargetWorldObject ()
 
Unit * GetExplTargetUnit ()
 
GameObject * GetExplTargetGObj ()
 
Item * GetExplTargetItem ()
 
Unit * GetHitUnit ()
 
Creature * GetHitCreature ()
 
Player * GetHitPlayer ()
 
Item * GetHitItem ()
 
GameObject * GetHitGObj ()
 
WorldLocation * GetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
Spell * GetSpell ()
 
Aura * GetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
Item * GetCastItem ()
 
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< CastHandler > BeforeCast
 
HookList< CastHandler > OnCast
 
HookList< CastHandler > AfterCast
 
HookList< CheckCastHandler > OnCheckCast
 
HookList< EffectHandler > OnEffectLaunch
 
HookList< EffectHandler > OnEffectLaunchTarget
 
HookList< EffectHandler > OnEffectHit
 
HookList< EffectHandler > OnEffectHitTarget
 
HookList< BeforeHitHandler > BeforeHit
 
HookList< HitHandler > OnHit
 
HookList< HitHandler > AfterHit
 
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
 
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
 
- 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
460 {
461 Unit* caster = GetCaster();
462 if (Unit* unitTarget = GetHitUnit())
463 {
464 uint32 spellId = 0;
465 int32 basePoint = 0;
466 Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
467 for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
468 {
469 Aura* aura = i->second->GetBase();
470 if (aura->GetCasterGUID() != caster->GetGUID())
471 continue;
472
473 // Search only Serpent Sting, Viper Sting, Scorpid Sting auras
474 flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
475 if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
476 continue;
477 if (AuraEffect* aurEff = aura->GetEffect(0))
478 {
479 // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
480 if (familyFlag[0] & 0x4000)
481 {
482 int32 TickCount = aurEff->GetTotalTicks();
484 basePoint = aurEff->GetAmount();
485 ApplyPct(basePoint, TickCount * 40);
486 basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
487 }
488 // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
489 else if (familyFlag[1] & 0x00000080)
490 {
491 int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
493
494 // Amount of one aura tick
495 basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
496 int32 casterBasePoint = aurEff->GetAmount() * caster->GetMaxPower(POWER_MANA) / 50;
497 if (basePoint > casterBasePoint)
498 basePoint = casterBasePoint;
499 ApplyPct(basePoint, TickCount * 60);
500 }
501 // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
502 else if (familyFlag[0] & 0x00008000)
503 {
504 if (caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
505 {
507 break;
508
510 }
511
513 }
514
515 // Refresh aura duration
516 aura->RefreshDuration();
517 aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false);
518 }
519 break;
520 }
521
522 if (spellId)
523 caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
524 }
525 }
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:259
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:7069
Definition SpellAuras.h:88
void RefreshDuration(bool withMods=false)
Definition SpellAuras.cpp:915
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:106
AuraEffect * GetEffect(uint8 effIndex) const
Definition SpellAuras.h:177
uint8 GetStackAmount() const
Definition SpellAuras.h:149
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:101
Player * ToPlayer()
Definition Object.h:208
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
bool HasSpellCooldown(uint32 spell_id) const override
Definition Player.cpp:16726
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11267
flag96 SpellFamilyFlags
Definition SpellInfo.h:412
Unit * GetHitUnit()
Definition SpellScript.cpp:453
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:667
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:1429
uint32 GetMaxPower(Powers power) const
Definition Unit.h:1144
boost::container::flat_multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:676
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.

528 {
530 }
@ 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:459

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: