[11105] Melee attacks distance

Inspired by patch provided by Feanordev.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Schmoozerd 2011-02-03 00:35:53 +03:00 committed by VladimirMangos
parent aa4c1be8cf
commit 8e68d1bcaf
13 changed files with 77 additions and 43 deletions

View file

@ -316,9 +316,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
}
}
if(!pAttacker->IsOutOfThreatArea(target)) // skip non attackable currently targets
if (!pAttacker->IsOutOfThreatArea(target)) // skip non attackable currently targets
{
if(pCurrentVictim) // select 1.3/1.1 better target in comparison current target
if (pCurrentVictim) // select 1.3/1.1 better target in comparison current target
{
// list sorted and and we check current target, then this is best case
if(pCurrentVictim == currentRef || currentRef->getThreat() <= 1.1f * pCurrentVictim->getThreat() )
@ -330,7 +330,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
if (currentRef->getThreat() > 1.3f * pCurrentVictim->getThreat() ||
(currentRef->getThreat() > 1.1f * pCurrentVictim->getThreat() &&
pAttacker->IsWithinDistInMap(target, ATTACK_DISTANCE)) )
pAttacker->CanReachWithMeleeAttack(target)) )
{ //implement 110% threat rule for targets in melee range
found = true; //and 130% rule for targets in ranged distances
break; //for selecting alive targets