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

Private Member Functions

 PrepareSpellScript (spell_item_draenic_pale_ale)
 
void HandleSummon (SpellEffIndex effIndex)
 
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 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< 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

◆ HandleSummon()

void spell_item_draenic_pale_ale::HandleSummon ( SpellEffIndex  effIndex)
inlineprivate
1322 {
1323 PreventHitDefaultEffect(effIndex);
1324 if (roll_chance_i(70))
1325 return;
1326
1328
1329 float radius = GetSpellInfo()->Effects[effIndex].CalcRadius();
1330 for (uint8 count = 0; count < GetEffectValue(); ++count)
1331 {
1332 Position pos = *GetCaster();
1333 GetCaster()->GetClosePoint(pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.GetOrientation(), radius, M_PI - 1.2f + 0.3f * urand(0, 8));
1334 Creature* summon = GetCaster()->SummonCreature(GetSpellInfo()->Effects[effIndex].MiscValue, pos, TEMPSUMMON_TIMED_DESPAWN, GetSpellInfo()->GetDuration());
1335 if (!summon)
1336 continue;
1337
1338 summon->SetOwnerGUID(GetCaster()->GetGUID());
1339 summon->SetFaction(GetCaster()->GetFaction());
1340 summon->SetImmuneToAll(true);
1343 GetSpell()->ExecuteLogEffectSummonObject(effIndex, summon);
1344 }
1345 }
std::uint8_t uint8
Definition Define.h:109
@ MOTION_SLOT_CONTROLLED
Definition MotionMaster.h:66
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:52
constexpr float PET_FOLLOW_DIST
Definition PetDefines.h:206
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
bool roll_chance_i(int chance)
Definition Random.h:63
@ REACT_PASSIVE
Definition Unit.h:567
Definition Creature.h:47
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:100
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true, bool inheritSpeed=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:448
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
SpellInfo const * GetSpellInfo()
Definition SpellScript.cpp:416
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition SpellScript.cpp:595
int32 GetEffectValue() const
Definition SpellScript.cpp:605
Spell * GetSpell()
Definition SpellScript.h:443
Unit * GetCaster()
Definition SpellScript.cpp:401
void ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject *obj)
Definition Spell.cpp:5307
void SetFaction(uint32 faction)
Definition Unit.cpp:6850
MotionMaster * GetMotionMaster()
Definition Unit.h:1761
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:1372
void SetOwnerGUID(ObjectGuid owner)
Definition Unit.cpp:7460
void SetImmuneToAll(bool apply, bool keepCombat=false)
Definition Unit.h:930
bool GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
Definition Object.cpp:2825
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition Object.cpp:2453
@ SPELL_PINK_ELEKK
Definition spell_item.cpp:1314
Definition Position.h:27
float m_positionZ
Definition Position.h:57
float m_positionX
Definition Position.h:55
float m_positionY
Definition Position.h:56
float GetOrientation() const
Definition Position.h:124

References Unit::CastSpell(), SpellInfo::Effects, Spell::ExecuteLogEffectSummonObject(), SpellScript::GetCaster(), WorldObject::GetClosePoint(), SpellScript::GetEffectValue(), Unit::GetMotionMaster(), Position::GetOrientation(), SpellScript::GetSpell(), SpellScript::GetSpellInfo(), Position::m_positionX, Position::m_positionY, Position::m_positionZ, MOTION_SLOT_CONTROLLED, MotionMaster::MoveFollow(), PET_FOLLOW_DIST, SpellScript::PreventHitDefaultEffect(), REACT_PASSIVE, roll_chance_i(), Unit::SetFaction(), Unit::SetImmuneToAll(), Unit::SetOwnerGUID(), Creature::SetReactState(), SPELL_PINK_ELEKK, WorldObject::SummonCreature(), TEMPSUMMON_TIMED_DESPAWN, and urand().

Referenced by Register().

◆ PrepareSpellScript()

spell_item_draenic_pale_ale::PrepareSpellScript ( spell_item_draenic_pale_ale  )
private

◆ Register()

void spell_item_draenic_pale_ale::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1348 {
1350 }
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_EFFECT_SUMMON
Definition SharedDefines.h:794
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
HookList< EffectHandler > OnEffectHit
Definition SpellScript.h:335
void HandleSummon(SpellEffIndex effIndex)
Definition spell_item.cpp:1321

References EFFECT_0, HandleSummon(), SpellScript::OnEffectHit, SPELL_EFFECT_SUMMON, and SpellEffectFn.


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