mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
[7000] Fixed creature target selection in case all possible targets have a low priority
This commit is contained in:
parent
802b35fbb8
commit
01e4f069e2
3 changed files with 21 additions and 10 deletions
|
|
@ -265,11 +265,12 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe
|
||||||
{
|
{
|
||||||
HostilReference* currentRef = NULL;
|
HostilReference* currentRef = NULL;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
bool noPriorityTargetFound = false;
|
||||||
|
|
||||||
std::list<HostilReference*>::iterator lastRef = iThreatList.end();
|
std::list<HostilReference*>::iterator lastRef = iThreatList.end();
|
||||||
lastRef--;
|
lastRef--;
|
||||||
|
|
||||||
for(std::list<HostilReference*>::iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found; ++iter)
|
for(std::list<HostilReference*>::iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
|
||||||
{
|
{
|
||||||
currentRef = (*iter);
|
currentRef = (*iter);
|
||||||
|
|
||||||
|
|
@ -277,15 +278,24 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe
|
||||||
assert(target); // if the ref has status online the target must be there !
|
assert(target); // if the ref has status online the target must be there !
|
||||||
|
|
||||||
// some units are prefered in comparison to others
|
// some units are prefered in comparison to others
|
||||||
if(iter != lastRef && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask(), false) ||
|
if(!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask(), false) || target->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_DAMAGE)) )
|
||||||
target->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_DAMAGE)
|
{
|
||||||
) )
|
if(iter != lastRef)
|
||||||
{
|
{
|
||||||
// current victim is a second choice target, so don't compare threat with it below
|
// current victim is a second choice target, so don't compare threat with it below
|
||||||
if(currentRef == pCurrentVictim)
|
if(currentRef == pCurrentVictim)
|
||||||
pCurrentVictim = NULL;
|
pCurrentVictim = NULL;
|
||||||
|
++iter;
|
||||||
continue;
|
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
|
if(!pAttacker->IsOutOfThreatArea(target)) // skip non attackable currently targets
|
||||||
{
|
{
|
||||||
|
|
@ -312,6 +322,7 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
if(!found)
|
if(!found)
|
||||||
currentRef = NULL;
|
currentRef = NULL;
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ struct AchievementCriteriaEntry
|
||||||
uint32 rollValue; // 3
|
uint32 rollValue; // 3
|
||||||
uint32 count; // 4
|
uint32 count; // 4
|
||||||
} roll_need_on_loot;
|
} roll_need_on_loot;
|
||||||
// ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREEDON_LOOT= 51
|
// ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT= 51
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32 rollValue; // 3
|
uint32 rollValue; // 3
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6999"
|
#define REVISION_NR "7000"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue