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

Private Member Functions

 PrepareSpellScript (spell_marrowgar_bone_spike_graveyard_SpellScript)
 
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::spell_marrowgar_bone_spike_graveyard_SpellScript::HandleSpikes ( SpellEffIndex  effIndex)
inlineprivate
543 {
544 PreventHitDefaultEffect(effIndex);
545 if (Creature* marrowgar = GetCaster()->ToCreature())
546 {
547 bool didHit = false;
548 CreatureAI* marrowgarAI = marrowgar->AI();
549 uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
550
551 std::vector<Player*> validPlayers;
552 Map::PlayerList const& pList = marrowgar->GetMap()->GetPlayers();
553 for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
554 if (Player* plr = itr->GetSource())
555 if (plr->IsAlive() && !plr->IsGameMaster() && plr->GetExactDist2dSq(marrowgar) < (150.0f * 150.0f) && !plr->HasAura(SPELL_IMPALED))
556 if (!marrowgar->GetVictim() || marrowgar->GetVictim()->GetGUID() != plr->GetGUID())
557 if (plr->GetGUID() != marrowgarAI->GetGUID(0) && plr->GetGUID() != marrowgarAI->GetGUID(1) && plr->GetGUID() != marrowgarAI->GetGUID(2)) // not a bone slice target
558 validPlayers.push_back(plr);
559
560 std::vector<Player*>::iterator begin = validPlayers.begin(), end = validPlayers.end();
561
562 std::random_device rd;
563 std::shuffle(begin, end, std::default_random_engine{rd()});
564
565 for (uint8 i = 0; i < boneSpikeCount && i < validPlayers.size(); ++i)
566 {
567 Unit* target = validPlayers[i];
568 didHit = true;
569 //target->CastCustomSpell(boneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true);
570 target->CastSpell(target, boneSpikeSummonId[i], true);
571 }
572
573 if (didHit)
574 marrowgarAI->Talk(SAY_BONESPIKE);
575 }
576 }
std::uint8_t uint8
Definition: Define.h:110
@ SPELL_IMPALED
Definition: boss_lord_marrowgar.cpp:51
uint32 const boneSpikeSummonId[3]
Definition: boss_lord_marrowgar.cpp:72
@ SAY_BONESPIKE
Definition: boss_lord_marrowgar.cpp:34
Definition: LinkedList.h:139
virtual ObjectGuid GetGUID(int32=0) const
Definition: UnitAI.h:205
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:46
Definition: Player.h:1046
Definition: Unit.h:1290
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:1169
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::spell_marrowgar_bone_spike_graveyard_SpellScript::PrepareSpellScript ( spell_marrowgar_bone_spike_graveyard_SpellScript  )
private

◆ Register()

void spell_marrowgar_bone_spike_graveyard::spell_marrowgar_bone_spike_graveyard_SpellScript::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

579 {
581 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
@ EFFECT_1
Definition: SharedDefines.h:31
@ SPELL_EFFECT_APPLY_AURA
Definition: SharedDefines.h:756
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleSpikes(SpellEffIndex effIndex)
Definition: boss_lord_marrowgar.cpp:542

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