Merge remote-tracking branch 'origin/master' into mmaps
This commit is contained in:
commit
df0519607c
16 files changed
+548
-158
No files matched your search
@@ -173,6 +173,7 @@ Unit::Unit(bool isWorldObject): WorldObject(isWorldObject)
|
||||
, m_vehicleKit(NULL)
|
||||
, m_unitTypeMask(UNIT_MASK_NONE)
|
||||
, m_HostileRefManager(this)
|
||||
, _lastDamagedTime(0)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:4355)
|
||||
@@ -12416,6 +12417,10 @@ int32 Unit::ModifyHealth(int32 dVal)
|
||||
if (dVal == 0)
|
||||
return 0;
|
||||
|
||||
// Part of Evade mechanics. Only track health lost, not gained.
|
||||
if (dVal < 0 && GetTypeId() != TYPEID_PLAYER && !isPet())
|
||||
SetLastDamagedTime(time(NULL));
|
||||
|
||||
int32 curHealth = (int32)GetHealth();
|
||||
|
||||
int32 val = dVal + curHealth;
|
||||
@@ -13042,6 +13047,14 @@ Unit* Creature::SelectVictim()
|
||||
return target;
|
||||
}
|
||||
|
||||
// Case where mob is being kited.
|
||||
// Mob may not be in range to attack or may have dropped target. In any case,
|
||||
// don't evade if damage received within the last 10 seconds
|
||||
// Does not apply to world bosses to prevent kiting to cities
|
||||
if (!isWorldBoss() && !GetInstanceId())
|
||||
if (time(NULL) - GetLastDamagedTime() <= MAX_AGGRO_RESET_TIME)
|
||||
return target;
|
||||
|
||||
// last case when creature must not go to evade mode:
|
||||
// it in combat but attacker not make any damage and not enter to aggro radius to have record in threat list
|
||||
// for example at owner command to pet attack some far away creature
|
||||
|
||||
Reference in new issue
Block a user