318{
319
320
322 bool found = false;
323 bool noPriorityTargetFound = false;
324
325
326 if (currentVictim)
327 {
330 currentVictim = nullptr;
332 currentVictim = nullptr;
333 }
334
335 ThreatContainer::StorageType::const_iterator lastRef =
iThreatList.end();
336 --lastRef;
337
338
339 for (ThreatContainer::StorageType::const_iterator iter =
iThreatList.begin(); iter !=
iThreatList.end() && !found;)
340 {
341 currentRef = (*iter);
342
345
346
347
349 {
350 if (iter != lastRef)
351 {
352 ++iter;
353 continue;
354 }
355 else
356 {
357 noPriorityTargetFound = true;
359 continue;
360 }
361 }
362
363
365 {
366 if (currentVictim)
367 {
368 if (currentVictim == currentRef)
369 {
370 found = true;
371 break;
372 }
373
374
376 {
377 found = true;
378 break;
379 }
381 {
383 {
384 found = true;
385 break;
386 }
387 }
388 else
389 {
390 currentRef = currentVictim;
391 found = true;
392 break;
393 }
394 }
395 else
396 {
397 found = true;
398 break;
399 }
400 }
401 ++iter;
402 }
403 if (!found)
404 currentRef = nullptr;
405
406 return currentRef;
407}
#define ASSERT
Definition: Errors.h:68
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition: SpellDefines.h:44
@ SPELL_AURA_IGNORED
Definition: SpellAuraDefines.h:284
TO * getTarget() const
Definition: Reference.h:95
float GetThreat() const
Definition: ThreatMgr.h:62
bool CanCreatureAttack(Unit const *victim, bool skipDistCheck=false) const
Definition: Creature.cpp:2625
SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType=BASE_ATTACK, uint8=0) const override
Definition: Creature.h:164
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
bool HasNegativeAuraWithInterruptFlag(uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
Definition: Unit.cpp:5769
bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
Definition: Unit.cpp:5710
bool IsWithinMeleeRange(Unit const *obj, float dist=0.f) const
Definition: Unit.cpp:664
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12901