aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBiglad <none@none>2009-02-09 08:06:16 -0500
committerBiglad <none@none>2009-02-09 08:06:16 -0500
commit55177e392c4c596c1968b8e90d2e464901e1442c (patch)
tree7f247aef52808fbaae7f85f5699452d0216aea06
parent1ff96e6ac2f2b0a7c1e5a05f6f6143cf2ab25a06 (diff)
humanoids combat assist
--HG-- branch : trunk
-rw-r--r--src/game/CreatureAI.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index 8682bf064a5..885d9ddcadb 100644
--- a/src/game/CreatureAI.cpp
+++ b/src/game/CreatureAI.cpp
@@ -40,6 +40,20 @@ void CreatureAI::MoveInLineOfSight(Unit *who)
{
if(!me->getVictim() && me->canStartAttack(who))
AttackStart(who);
+
+ if (who->isInCombat() && who->getVictim() && me->GetCreatureType()==CREATURE_TYPE_HUMANOID && me->IsFriendlyTo(who))
+ {
+ if (me->GetDistanceZ(who) <= 2 && me->IsWithinLOSInMap(who))
+ {
+ float attackRadius = (me->GetAttackDistance(who) *0.5);
+ if (me->IsWithinDistInMap(who, attackRadius))
+ {
+ Unit* target = NULL;
+ target = who->getVictim();
+ AttackStart(target);
+ }
+ }
+ }
}
bool CreatureAI::UpdateVictim()