mirror of
https://github.com/mangosfour/server.git
synced 2025-12-23 16:37:03 +00:00
[11105] Melee attacks distance
Inspired by patch provided by Feanordev. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
aa4c1be8cf
commit
8e68d1bcaf
13 changed files with 77 additions and 43 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue