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

Private Member Functions

 PrepareSpellScript (spell_item_crazy_alchemists_potion)
 
void SecondaryEffect ()
 
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

◆ PrepareSpellScript()

spell_item_crazy_alchemists_potion::PrepareSpellScript ( spell_item_crazy_alchemists_potion  )
private

◆ Register()

void spell_item_crazy_alchemists_potion::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

5120 {
5122 }
#define SpellCastFn(F)
Definition SpellScript.h:324
HookList< CastHandler > AfterCast
Definition SpellScript.h:323
void SecondaryEffect()
Definition spell_item.cpp:5090

References SpellScript::AfterCast, SecondaryEffect(), and SpellCastFn.

◆ SecondaryEffect()

void spell_item_crazy_alchemists_potion::SecondaryEffect ( )
inlineprivate
5091 {
5092 std::vector<uint32> availableElixirs =
5093 {
5094 43185, // Runic Healing Potion (33447)
5095 53750, // Crazy Alchemist's Potion (40077)
5096 53761, // Powerful Rejuvenation Potion (40087)
5097 53762, // Indestructible Potion (40093)
5098 53908, // Potion of Speed (40211)
5099 53909, // Potion of Wild Magic (40212)
5100 53910, // Mighty Arcane Protection Potion (40213)
5101 53911, // Mighty Fire Protection Potion (40214)
5102 53913, // Mighty Frost Protection Potion (40215)
5103 53914, // Mighty Nature Protection Potion (40216)
5104 53915 // Mighty Shadow Protection Potion (40217)
5105 };
5106
5107 Unit* target = GetCaster();
5108
5109 if (!target->IsInCombat())
5110 availableElixirs.push_back(53753); // Potion of Nightmares (40081)
5111 if (target->getPowerType() == POWER_MANA)
5112 availableElixirs.push_back(43186); // Runic Mana Potion (33448)
5113
5114 uint32 chosenElixir = Acore::Containers::SelectRandomContainerElement(availableElixirs);
5115
5116 target->CastSpell(target, chosenElixir, GetCastItem());
5117 }
std::uint32_t uint32
Definition Define.h:107
@ POWER_MANA
Definition SharedDefines.h:257
Item * GetCastItem()
Definition SpellScript.cpp:625
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Unit.h:665
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
Powers getPowerType() const
Definition Unit.h:1137
bool IsInCombat() const
Definition Unit.h:941
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:133

References Unit::CastSpell(), SpellScript::GetCaster(), SpellScript::GetCastItem(), Unit::getPowerType(), Unit::IsInCombat(), POWER_MANA, and Acore::Containers::SelectRandomContainerElement().

Referenced by Register().


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