diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index e3f496133..68ddf098e 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -265,11 +265,12 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe { HostilReference* currentRef = NULL; bool found = false; + bool noPriorityTargetFound = false; std::list::iterator lastRef = iThreatList.end(); lastRef--; - for(std::list::iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found; ++iter) + for(std::list::iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) { currentRef = (*iter); @@ -277,14 +278,23 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe assert(target); // if the ref has status online the target must be there ! // some units are prefered in comparison to others - if(iter != lastRef && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask(), false) || - target->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_DAMAGE) - ) ) + if(!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask(), false) || target->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_DAMAGE)) ) { - // current victim is a second choice target, so don't compare threat with it below - if(currentRef == pCurrentVictim) - pCurrentVictim = NULL; - continue; + if(iter != lastRef) + { + // current victim is a second choice target, so don't compare threat with it below + if(currentRef == pCurrentVictim) + pCurrentVictim = NULL; + ++iter; + continue; + } + else + { + // if we reached to this point, everyone in the threatlist is a second choice target. In such a situation the target with the highest threat should be attacked. + noPriorityTargetFound = true; + iter = iThreatList.begin(); + continue; + } } if(!pAttacker->IsOutOfThreatArea(target)) // skip non attackable currently targets @@ -312,6 +322,7 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe break; } } + ++iter; } if(!found) currentRef = NULL; diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h index 25b74b77a..ebc33d629 100644 --- a/src/shared/Database/DBCStructure.h +++ b/src/shared/Database/DBCStructure.h @@ -325,7 +325,7 @@ struct AchievementCriteriaEntry uint32 rollValue; // 3 uint32 count; // 4 } roll_need_on_loot; - // ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREEDON_LOOT= 51 + // ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT= 51 struct { uint32 rollValue; // 3 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 11595c659..9ecba6676 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "6999" + #define REVISION_NR "7000" #endif // __REVISION_NR_H__