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 void Register ()=0
 
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 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
 
virtual bool _Validate (SpellInfo const *entry)
 
- 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
Todo:
: Caster uses unitTarget?
443 {
444 Unit* caster = GetCaster();
445 if (Unit* unitTarget = GetHitUnit())
446 {
447 uint32 spellId = 0;
448 int32 basePoint = 0;
449 Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
450 for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
451 {
452 Aura* aura = i->second->GetBase();
453 if (aura->GetCasterGUID() != caster->GetGUID())
454 continue;
455
456 // Search only Serpent Sting, Viper Sting, Scorpid Sting auras
457 flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
458 if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
459 continue;
460 if (AuraEffect* aurEff = aura->GetEffect(0))
461 {
462 // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
463 if (familyFlag[0] & 0x4000)
464 {
465 int32 TickCount = aurEff->GetTotalTicks();
467 basePoint = aurEff->GetAmount();
468 ApplyPct(basePoint, TickCount * 40);
469 basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
470 }
471 // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
472 else if (familyFlag[1] & 0x00000080)
473 {
474 int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
476
477 // Amount of one aura tick
478 basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
479 int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50;
480 if (basePoint > casterBasePoint)
481 basePoint = casterBasePoint;
482 ApplyPct(basePoint, TickCount * 60);
483 }
484 // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
485 else if (familyFlag[0] & 0x00008000)
486 {
487 if (caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
488 {
490 break;
491
493 }
494
496 }
497
498 // Refresh aura duration
499 aura->RefreshDuration();
500 aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false);
501 }
502 break;
503 }
504
505 if (spellId)
506 caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
507 }
508 }
T ApplyPct(T &base, U pct)
Definition: Util.h:73
T CalculatePct(T base, U pct)
Definition: Util.h:61
std::int32_t int32
Definition: Define.h:103
std::uint32_t uint32
Definition: Define.h:107
@ SPELL_HUNTER_CHIMERA_SHOT_SCORPID
Definition: spell_hunter.cpp:53
@ SPELL_HUNTER_CHIMERA_SHOT_VIPER
Definition: spell_hunter.cpp:52
@ SPELL_HUNTER_CHIMERA_SHOT_SERPENT
Definition: spell_hunter.cpp:51
@ POWER_MANA
Definition: SharedDefines.h:269
@ DOT
Definition: Unit.h:250
Definition: Util.h:451
Player * ToPlayer()
Definition: Object.h:201
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Player.cpp:16364
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition: Player.cpp:11120
Definition: Unit.h:630
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:639
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:1224
Definition: SpellAuraEffects.h:39
int32 GetTotalTicks() const
Definition: SpellAuraEffects.cpp:7370
Definition: SpellAuras.h:87
void RefreshDuration(bool withMods=false)
Definition: SpellAuras.cpp:880
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:105
AuraEffect * GetEffect(uint8 effIndex) const
Definition: SpellAuras.h:175
uint8 GetStackAmount() const
Definition: SpellAuras.h:148
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:100
flag96 SpellFamilyFlags
Definition: SpellInfo.h:388
Unit * GetHitUnit()
Definition: SpellScript.cpp:448
Unit * GetCaster()
Definition: SpellScript.cpp:401

References Player::AddSpellCooldown(), ApplyPct(), CalculatePct(), Unit::CastCustomSpell(), DOT, SpellScript::GetCaster(), Aura::GetCasterGUID(), Aura::GetEffect(), Object::GetGUID(), SpellScript::GetHitUnit(), 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.

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

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

◆ Validate()

bool spell_hun_chimera_shot::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual