From 55177e392c4c596c1968b8e90d2e464901e1442c Mon Sep 17 00:00:00 2001 From: Biglad Date: Mon, 9 Feb 2009 08:06:16 -0500 Subject: humanoids combat assist --HG-- branch : trunk --- src/game/CreatureAI.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') 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() -- cgit v1.2.3