mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Core/Maps: Add Map::DoOnPlayers helper function (#25233)
This commit is contained in:
@@ -653,21 +653,16 @@ class npc_acolyte_of_shadron : public CreatureScript
|
||||
if (ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON)))
|
||||
instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED);
|
||||
|
||||
Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
|
||||
|
||||
if (PlayerList.isEmpty())
|
||||
return;
|
||||
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
instance->instance->DoOnPlayers([](Player* player)
|
||||
{
|
||||
if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim())
|
||||
if (player->IsAlive() && player->HasAura(SPELL_TWILIGHT_SHIFT) && !player->GetVictim())
|
||||
{
|
||||
i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true);
|
||||
i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true);
|
||||
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT);
|
||||
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER);
|
||||
player->CastSpell(player, SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true);
|
||||
player->CastSpell(player, SPELL_TWILIGHT_RESIDUE, true);
|
||||
player->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT);
|
||||
player->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// not solo fight, so main boss has debuff
|
||||
if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
|
||||
@@ -737,23 +732,19 @@ class npc_acolyte_of_vesperon : public CreatureScript
|
||||
vesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
|
||||
}
|
||||
|
||||
Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
|
||||
|
||||
if (PlayerList.isEmpty())
|
||||
return;
|
||||
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
instance->instance->DoOnPlayers([](Player* player)
|
||||
{
|
||||
if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim())
|
||||
if (player->IsAlive() && player->HasAura(SPELL_TWILIGHT_SHIFT) && !player->GetVictim())
|
||||
{
|
||||
i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true);
|
||||
i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true);
|
||||
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT);
|
||||
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER);
|
||||
player->CastSpell(player, SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true);
|
||||
player->CastSpell(player, SPELL_TWILIGHT_RESIDUE, true);
|
||||
player->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT);
|
||||
player->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER);
|
||||
}
|
||||
if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP) && !i->GetSource()->GetVictim())
|
||||
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
|
||||
}
|
||||
|
||||
if (player->IsAlive() && player->HasAura(SPELL_TWILIGHT_TORMENT_VESP) && !player->GetVictim())
|
||||
player->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
|
||||
});
|
||||
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO, true, true);
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(57935, true, true);
|
||||
|
||||
@@ -28,6 +28,7 @@ EndScriptData */
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "InstanceScript.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
@@ -110,21 +111,22 @@ public:
|
||||
//Inhibitmagic_Timer
|
||||
if (Inhibitmagic_Timer <= diff)
|
||||
{
|
||||
float dist;
|
||||
Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
if (Player* i_pl = i->GetSource())
|
||||
if (i_pl->IsAlive() && (dist = i_pl->GetDistance(me)) < 45)
|
||||
{
|
||||
i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC);
|
||||
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
|
||||
if (dist < 35)
|
||||
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
|
||||
if (dist < 25)
|
||||
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
|
||||
if (dist < 15)
|
||||
me->AddAura(SPELL_INHIBITMAGIC, i_pl);
|
||||
}
|
||||
me->GetMap()->DoOnPlayers([this](Player* player)
|
||||
{
|
||||
float dist = player->GetDistance(me);
|
||||
|
||||
if (player->IsAlive() && dist < 45.f)
|
||||
{
|
||||
player->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC);
|
||||
me->AddAura(SPELL_INHIBITMAGIC, player);
|
||||
if (dist < 35)
|
||||
me->AddAura(SPELL_INHIBITMAGIC, player);
|
||||
if (dist < 25)
|
||||
me->AddAura(SPELL_INHIBITMAGIC, player);
|
||||
if (dist < 15)
|
||||
me->AddAura(SPELL_INHIBITMAGIC, player);
|
||||
}
|
||||
});
|
||||
Inhibitmagic_Timer = 3000 + (rand32() % 1000);
|
||||
} else Inhibitmagic_Timer -= diff;
|
||||
|
||||
|
||||
@@ -186,11 +186,11 @@ class boss_grandmaster_vorpil : public CreatureScript
|
||||
break;
|
||||
case EVENT_DRAW_SHADOWS:
|
||||
{
|
||||
Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
if (Player* i_pl = i->GetSource())
|
||||
if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH))
|
||||
i_pl->TeleportTo(me->GetMapId(), VorpilPosition.GetPositionX(), VorpilPosition.GetPositionY(), VorpilPosition.GetPositionZ(), VorpilPosition.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
|
||||
instance->instance->DoOnPlayers([this](Player* player)
|
||||
{
|
||||
if (player->IsAlive() && !player->HasAura(SPELL_BANISH))
|
||||
player->TeleportTo(me->GetMapId(), VorpilPosition.GetPositionX(), VorpilPosition.GetPositionY(), VorpilPosition.GetPositionZ(), VorpilPosition.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
|
||||
});
|
||||
|
||||
me->UpdatePosition(VorpilPosition);
|
||||
DoCast(me, SPELL_DRAW_SHADOWS, true);
|
||||
|
||||
@@ -285,12 +285,11 @@ public:
|
||||
|
||||
if (RotTimer)
|
||||
{
|
||||
Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
instance->instance->DoOnPlayers([this, diff](Player* player)
|
||||
{
|
||||
if (i->GetSource() && i->GetSource()->IsAlive() && me->HasInArc(diff/20000.f*float(M_PI)*2.f, i->GetSource()) && me->IsWithinDist(i->GetSource(), SPOUT_DIST) && !i->GetSource()->IsInWater())
|
||||
DoCast(i->GetSource(), SPELL_SPOUT, true); // only knock back players in arc, in 100yards, not in water
|
||||
}
|
||||
if (player->IsAlive() && me->HasInArc(diff / 20000.f * float(M_PI) * 2.f, player) && me->IsWithinDist(player, SPOUT_DIST) && !player->IsInWater())
|
||||
DoCast(player, SPELL_SPOUT, true); // only knock back players in arc, in 100yards, not in water
|
||||
});
|
||||
|
||||
if (SpoutAnimTimer <= diff)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user