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

Private Member Functions

 PrepareSpellScript (spell_marrowgar_bone_spike_graveyard)
 
bool Validate (SpellInfo const *) override
 
void HandleSpikes (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 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

◆ HandleSpikes()

void spell_marrowgar_bone_spike_graveyard::HandleSpikes ( SpellEffIndex  effIndex)
inlineprivate
538 {
539 PreventHitDefaultEffect(effIndex);
540 if (Creature* marrowgar = GetCaster()->ToCreature())
541 {
542 bool didHit = false;
543 CreatureAI* marrowgarAI = marrowgar->AI();
544 uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
545
546 std::vector<Player*> validPlayers;
547 Map::PlayerList const& pList = marrowgar->GetMap()->GetPlayers();
548 for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
549 if (Player* plr = itr->GetSource())
550 if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(marrowgar) < (150.0f * 150.0f) && !plr->HasAura(SPELL_IMPALED))
551 if (!marrowgar->GetVictim() || marrowgar->GetVictim()->GetGUID() != plr->GetGUID())
552 if (plr->GetGUID() != marrowgarAI->GetGUID(0) && plr->GetGUID() != marrowgarAI->GetGUID(1) && plr->GetGUID() != marrowgarAI->GetGUID(2)) // not a bone slice target
553 validPlayers.push_back(plr);
554
555 std::vector<Player*>::iterator begin = validPlayers.begin(), end = validPlayers.end();
556
557 std::random_device rd;
558 std::shuffle(begin, end, std::default_random_engine{rd()});
559
560 for (uint8 i = 0; i < boneSpikeCount && i < validPlayers.size(); ++i)
561 {
562 Unit* target = validPlayers[i];
563 didHit = true;
564 //target->CastCustomSpell(boneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true);
565 target->CastSpell(target, boneSpikeSummonId[i], true);
566 }
567
568 if (didHit)
569 marrowgarAI->Talk(SAY_BONESPIKE);
570 }
571 }
std::uint8_t uint8
Definition Define.h:109
@ SPELL_IMPALED
Definition boss_lord_marrowgar.cpp:52
uint32 const boneSpikeSummonId[3]
Definition boss_lord_marrowgar.cpp:73
@ SAY_BONESPIKE
Definition boss_lord_marrowgar.cpp:35
Definition CreatureAI.h:69
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0ms)
Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
Definition CreatureAI.cpp:67
Definition Creature.h:47
Definition LinkedList.h:139
Definition MapRefMgr.h:26
iterator begin()
Definition MapRefMgr.h:36
iterator end()
Definition MapRefMgr.h:37
Definition Player.h:1086
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition SpellScript.cpp:595
Unit * GetCaster()
Definition SpellScript.cpp:401
virtual ObjectGuid GetGUID(int32=0) const
Definition UnitAI.h:221
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

References MapRefMgr::begin(), boneSpikeSummonId, Unit::CastSpell(), MapRefMgr::end(), SpellScript::GetCaster(), UnitAI::GetGUID(), SpellScript::PreventHitDefaultEffect(), SAY_BONESPIKE, SPELL_IMPALED, and CreatureAI::Talk().

Referenced by Register().

◆ PrepareSpellScript()

spell_marrowgar_bone_spike_graveyard::PrepareSpellScript ( spell_marrowgar_bone_spike_graveyard  )
private

◆ Register()

void spell_marrowgar_bone_spike_graveyard::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

574 {
576 }
@ EFFECT_1
Definition SharedDefines.h:32
@ SPELL_EFFECT_APPLY_AURA
Definition SharedDefines.h:772
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
HookList< EffectHandler > OnEffectHitTarget
Definition SpellScript.h:336
void HandleSpikes(SpellEffIndex effIndex)
Definition boss_lord_marrowgar.cpp:537

References EFFECT_1, HandleSpikes(), SpellScript::OnEffectHitTarget, SPELL_EFFECT_APPLY_AURA, and SpellEffectFn.

◆ Validate()

bool spell_marrowgar_bone_spike_graveyard::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

533 {
535 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition SpellScript.h:125

References SPELL_IMPALED, and _SpellScript::ValidateSpellInfo().


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