1205 {
1208 {
1209 return;
1210 }
1211
1213 if (!target)
1214 {
1215 return;
1216 }
1217
1219 {
1220 float distTarget = target->
GetDistance2d(itr.second.m_positionX, itr.second.m_positionY);
1221 if (distTarget <= 30.f)
1222 {
1223 caster->
CastSpell(caster, itr.first,
true);
1224 return;
1225 }
1226 }
1227
1228
1230 caster->
CastSpell(caster, spellId.first,
true);
1231 }
std::unordered_map< uint32, const Position > const spellPos
Definition: boss_nefarian.cpp:1183
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:133
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:110
CreatureAI * AI() const
Definition: Creature.h:143
Creature * ToCreature()
Definition: Object.h:202
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1263
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
Unit * GetCaster()
Definition: SpellScript.cpp:401