diff options
author | megamage <none@none> | 2009-08-26 16:54:59 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-08-26 16:54:59 -0500 |
commit | a35991c8365575226394f90071dc97894e94f21c (patch) | |
tree | 450f5f2eec929dacc5c09f1e13c9eaa7a75a81ba /src/game/CombatAI.cpp | |
parent | dad2c55287d4a9c35cbfa1ad4e8d3e8e8255f588 (diff) |
*Add function CanAIAttack
--HG--
branch : trunk
Diffstat (limited to 'src/game/CombatAI.cpp')
-rw-r--r-- | src/game/CombatAI.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/game/CombatAI.cpp b/src/game/CombatAI.cpp index 37ef8186e2b..b18e6dd7532 100644 --- a/src/game/CombatAI.cpp +++ b/src/game/CombatAI.cpp @@ -223,6 +223,15 @@ TurretAI::TurretAI(Creature *c) : CreatureAI(c) me->m_SightDistance = me->m_CombatDistance; } +bool TurretAI::CanAIAttack(const Unit *who) const +{ + // TODO: use one function to replace it + if(!me->IsWithinCombatRange(me->getVictim(), me->m_CombatDistance) + || m_minRange && me->IsWithinCombatRange(me->getVictim(), m_minRange)) + return false; + return true; +} + void TurretAI::AttackStart(Unit *who) { if(who) @@ -234,7 +243,9 @@ void TurretAI::UpdateAI(const uint32 diff) if(!UpdateVictim()) return; - if(m_minRange && me->IsWithinCombatRange(me->getVictim(), m_minRange) || !DoSpellAttackIfReady(me->m_spells[0])) - if(HostilReference *ref = me->getThreatManager().getCurrentVictim()) - ref->removeReference(); + DoSpellAttackIfReady(me->m_spells[0]); + + //if(!DoSpellAttackIfReady(me->m_spells[0])) + //if(HostilReference *ref = me->getThreatManager().getCurrentVictim()) + //ref->removeReference(); } |