AzerothCore 3.3.5a
OpenSource WoW Emulator
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
Todo:
: Caster uses unitTarget?
440 {
441 Unit* caster = GetCaster();
442 if (Unit* unitTarget = GetHitUnit())
443 {
444 uint32 spellId = 0;
445 int32 basePoint = 0;
446 Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
447 for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
448 {
449 Aura* aura = i->second->GetBase();
450 if (aura->GetCasterGUID() != caster->GetGUID())
451 continue;
452
453 // Search only Serpent Sting, Viper Sting, Scorpid Sting auras
454 flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
455 if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
456 continue;
457 if (AuraEffect* aurEff = aura->GetEffect(0))
458 {
459 // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
460 if (familyFlag[0] & 0x4000)
461 {
462 int32 TickCount = aurEff->GetTotalTicks();
464 basePoint = aurEff->GetAmount();
465 ApplyPct(basePoint, TickCount * 40);
466 basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
467 }
468 // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
469 else if (familyFlag[1] & 0x00000080)
470 {
471 int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
473
474 // Amount of one aura tick
475 basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
476 int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50;
477 if (basePoint > casterBasePoint)
478 basePoint = casterBasePoint;
479 ApplyPct(basePoint, TickCount * 60);
480 }
481 // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
482 else if (familyFlag[0] & 0x00008000)
483 {
484 if (caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
485 {
487 break;
488
490 }
491
493 }
494
495 // Refresh aura duration
496 aura->RefreshDuration();
497 aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false);
498 }
499 break;
500 }
501
502 if (spellId)
503 caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
504 }
505 }
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
@ POWER_MANA
Definition SharedDefines.h:269
@ DOT
Definition Unit.h:251
T ApplyPct(T &base, U pct)
Definition Util.h:73
T CalculatePct(T base, U pct)
Definition Util.h:61
Definition SpellAuraEffects.h:39
int32 GetTotalTicks() const
Definition SpellAuraEffects.cpp:7375
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
Player * ToPlayer()
Definition Object.h:202
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113
bool HasSpellCooldown(uint32 spell_id) const override
Definition Player.cpp:16272
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition Player.cpp:11034
flag96 SpellFamilyFlags
Definition SpellInfo.h:388
Unit * GetHitUnit()
Definition SpellScript.cpp:448
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:620
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition Unit.h:629
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:1236
Definition Util.h:451
@ SPELL_HUNTER_CHIMERA_SHOT_SCORPID
Definition spell_hunter.cpp:50
@ SPELL_HUNTER_CHIMERA_SHOT_VIPER
Definition spell_hunter.cpp:49
@ SPELL_HUNTER_CHIMERA_SHOT_SERPENT
Definition spell_hunter.cpp:48

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.

508 {
510 }
@ 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:439

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: