diff options
author | megamage <none@none> | 2009-01-30 18:10:05 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-01-30 18:10:05 -0600 |
commit | 8fee06f041fbfbc7e22eccc03a8f12bd7a649999 (patch) | |
tree | 9512260148dabb87926131a225831e72980a250d /src/game/AggressorAI.cpp | |
parent | 03234a0657eca4836b1015556973629893c76958 (diff) |
*AI structure update.
--HG--
branch : trunk
Diffstat (limited to 'src/game/AggressorAI.cpp')
-rw-r--r-- | src/game/AggressorAI.cpp | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/src/game/AggressorAI.cpp b/src/game/AggressorAI.cpp index a11584eab64..65dd1849217 100644 --- a/src/game/AggressorAI.cpp +++ b/src/game/AggressorAI.cpp @@ -38,29 +38,10 @@ AggressorAI::Permissible(const Creature *creature) return PERMIT_BASE_NO; } -AggressorAI::AggressorAI(Creature *c) : i_creature(*c), i_victimGuid(0), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK) +AggressorAI::AggressorAI(Creature *c) : CreatureAI(c), i_creature(*c), i_victimGuid(0), i_state(STATE_NORMAL), i_tracker(TIME_INTERVAL_LOOK) { } -void -AggressorAI::MoveInLineOfSight(Unit *u) -{ - if(!i_creature.getVictim() && i_creature.canStartAttack(u)) - AttackStart(u); - - /* - if(!i_creature.getVictim()) - { - AttackStart(u); - } - else if(sMapStore.LookupEntry(i_creature.GetMapId())->IsDungeon()) - { - u->SetInCombatWith(&i_creature); - i_creature.AddThreat(u, 0.0f); - } - */ -} - void AggressorAI::EnterEvadeMode() { if( !i_creature.isAlive() ) @@ -118,7 +99,7 @@ void AggressorAI::UpdateAI(const uint32 /*diff*/) { // update i_victimGuid if i_creature.getVictim() !=0 and changed - if(!i_creature.SelectHostilTarget() || !i_creature.getVictim()) + if(!UpdateVictim()) return; i_victimGuid = i_creature.getVictim()->GetGUID(); @@ -132,26 +113,3 @@ AggressorAI::UpdateAI(const uint32 /*diff*/) } } } - -bool -AggressorAI::IsVisible(Unit *pl) const -{ - return i_creature.GetDistance(pl) < sWorld.getConfig(CONFIG_SIGHT_MONSTER) - && pl->isVisibleForOrDetect(&i_creature,true); -} - -void -AggressorAI::AttackStart(Unit *u) -{ - if( !u ) - return; - - if(i_creature.Attack(u,true)) - { - i_creature.AddThreat(u, 0.0f); - // DEBUG_LOG("Creature %s tagged a victim to kill [guid=%u]", i_creature.GetName(), u->GetGUIDLow()); - i_victimGuid = u->GetGUID(); - - i_creature.GetMotionMaster()->MoveChase(u); - } -} |