533 {
536 {
537 bool didHit = false;
540
541 std::vector<Player*> validPlayers;
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))
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
561 }
562
563 if (didHit)
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:71
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:1064
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:1168
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