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
 
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 void Register ()=0
 
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< 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
 
virtual bool _Validate (SpellInfo const *entry)
 
- 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
533 {
534 PreventHitDefaultEffect(effIndex);
535 if (Creature* marrowgar = GetCaster()->ToCreature())
536 {
537 bool didHit = false;
538 CreatureAI* marrowgarAI = marrowgar->AI();
539 uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
540
541 std::vector<Player*> validPlayers;
542 Map::PlayerList const& pList = marrowgar->GetMap()->GetPlayers();
543 for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
544 if (Player* plr = itr->GetSource())
545 if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(marrowgar) < (150.0f * 150.0f) && !plr->HasAura(SPELL_IMPALED))
546 if (!marrowgar->GetVictim() || marrowgar->GetVictim()->GetGUID() != plr->GetGUID())
547 if (plr->GetGUID() != marrowgarAI->GetGUID(0) && plr->GetGUID() != marrowgarAI->GetGUID(1) && plr->GetGUID() != marrowgarAI->GetGUID(2)) // not a bone slice target
548 validPlayers.push_back(plr);
549
550 std::vector<Player*>::iterator begin = validPlayers.begin(), end = validPlayers.end();
551
552 std::random_device rd;
553 std::shuffle(begin, end, std::default_random_engine{rd()});
554
555 for (uint8 i = 0; i < boneSpikeCount && i < validPlayers.size(); ++i)
556 {
557 Unit* target = validPlayers[i];
558 didHit = true;
559 //target->CastCustomSpell(boneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true);
560 target->CastSpell(target, boneSpikeSummonId[i], true);
561 }
562
563 if (didHit)
564 marrowgarAI->Talk(SAY_BONESPIKE);
565 }
566 }
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: LinkedList.h:139
virtual ObjectGuid GetGUID(int32=0) const
Definition: UnitAI.h:216
Definition: CreatureAI.h:70
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s)
Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
Definition: CreatureAI.cpp:50
Definition: Creature.h:43
Definition: Player.h:1081
Definition: Unit.h:630
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:1167
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition: SpellScript.cpp:590
Unit * GetCaster()
Definition: SpellScript.cpp:401

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.

569 {
571 }
@ EFFECT_1
Definition: SharedDefines.h:32
@ SPELL_EFFECT_APPLY_AURA
Definition: SharedDefines.h:784
#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:532

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.

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

References SPELL_IMPALED, and _SpellScript::ValidateSpellInfo().