aboutsummaryrefslogtreecommitdiff
path: root/src/game/Creature.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-27 13:54:57 -0500
committermegamage <none@none>2009-08-27 13:54:57 -0500
commitd91903e5b1b2ffac46fa8a0129e98ffcaaa95aa1 (patch)
tree4e0d2b8e7fa0bee1317ef322145b8add40aa4abd /src/game/Creature.cpp
parent72c18a735408254aaf676208750a3c2073e49ea2 (diff)
*Fix the behavior of mob assistance.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r--src/game/Creature.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 3e857a34acc..6b018a6254f 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1706,8 +1706,16 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
// TODO: should switch to range attack
return false;
- if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
- return false;
+ if(!force)
+ {
+ if(who->isInCombat())
+ if(Unit *victim = who->getAttackerForHelper())
+ if(IsWithinDistInMap(victim, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS)))
+ force = true;
+
+ if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who) + m_CombatDistance)))
+ return false;
+ }
if(!canCreatureAttack(who, force))
return false;