TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
spell_item_six_demon_bag::spell_item_six_demon_bag_SpellScript Class Reference

Private Member Functions

 PrepareSpellScript (spell_item_six_demon_bag_SpellScript)
 
bool Validate (SpellInfo const *) override
 
void HandleDummy (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 constGetSpellInfo ()
 
SpellValue constGetSpellValue ()
 
SpellEffectInfo constGetEffectInfo (SpellEffIndex) const
 
WorldLocation constGetExplTargetDest ()
 
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)
 
SpellEffectInfo constGetEffectInfo () const
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo constGetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
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 ()
 
- Public Attributes inherited from SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< EffectHandlerOnEffectSuccessfulDispel
 
HookList< HitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList
< ObjectAreaTargetSelectHandler
OnObjectAreaTargetSelect
 
HookList
< ObjectTargetSelectHandler
OnObjectTargetSelect
 
HookList
< DestinationTargetSelectHandler
OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string constm_scriptName
 
uint32 m_scriptSpellId
 

Member Function Documentation

void spell_item_six_demon_bag::spell_item_six_demon_bag_SpellScript::HandleDummy ( SpellEffIndex  )
inlineprivate
1204  {
1205  Unit* caster = GetCaster();
1206  if (Unit* target = GetHitUnit())
1207  {
1208  uint32 spellId = 0;
1209  uint32 rand = urand(0, 99);
1210  if (rand < 25) // Fireball (25% chance)
1211  spellId = SPELL_FIREBALL;
1212  else if (rand < 50) // Frostball (25% chance)
1213  spellId = SPELL_FROSTBOLT;
1214  else if (rand < 70) // Chain Lighting (20% chance)
1215  spellId = SPELL_CHAIN_LIGHTNING;
1216  else if (rand < 80) // Polymorph (10% chance)
1217  {
1218  spellId = SPELL_POLYMORPH;
1219  if (urand(0, 100) <= 30) // 30% chance to self-cast
1220  target = caster;
1221  }
1222  else if (rand < 95) // Enveloping Winds (15% chance)
1223  spellId = SPELL_ENVELOPING_WINDS;
1224  else // Summon Felhund minion (5% chance)
1225  {
1226  spellId = SPELL_SUMMON_FELHOUND_MINION;
1227  target = caster;
1228  }
1229 
1230  caster->CastSpell(target, spellId, true, GetCastItem());
1231  }
1232  }
Definition: spell_item.cpp:1180
Definition: spell_item.cpp:1179
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
Definition: spell_item.cpp:1181
uint32_t uint32
Definition: Define.h:150
Definition: spell_item.cpp:1183
Unit * GetCaster()
Definition: SpellScript.cpp:394
Definition: spell_item.cpp:1184
Item * GetCastItem()
Definition: SpellScript.cpp:622
Unit * GetHitUnit()
Definition: SpellScript.cpp:441
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: spell_item.cpp:1182

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

spell_item_six_demon_bag::spell_item_six_demon_bag_SpellScript::PrepareSpellScript ( spell_item_six_demon_bag_SpellScript  )
private
void spell_item_six_demon_bag::spell_item_six_demon_bag_SpellScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1235  {
1237  }
Definition: SharedDefines.h:28
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:297
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:295
Definition: SharedDefines.h:1013
void HandleDummy(SpellEffIndex)
Definition: spell_item.cpp:1203

+ Here is the call graph for this function:

bool spell_item_six_demon_bag::spell_item_six_demon_bag_SpellScript::Validate ( SpellInfo const )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

1197  {
1198  if (!sSpellMgr->GetSpellInfo(SPELL_FROSTBOLT) || !sSpellMgr->GetSpellInfo(SPELL_POLYMORPH) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_FELHOUND_MINION) || !sSpellMgr->GetSpellInfo(SPELL_FIREBALL) || !sSpellMgr->GetSpellInfo(SPELL_CHAIN_LIGHTNING) || !sSpellMgr->GetSpellInfo(SPELL_ENVELOPING_WINDS))
1199  return false;
1200  return true;
1201  }
Definition: spell_item.cpp:1180
Definition: spell_item.cpp:1179
Definition: spell_item.cpp:1181
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: spell_item.cpp:1183
Definition: spell_item.cpp:1184
Definition: spell_item.cpp:1182

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