From ab5f515f21d1f9e735e8b2c91a64f2dd02512ed5 Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 28 Aug 2009 11:26:20 -0500 Subject: *Update flame levi script. Allow player to shoot down pyrite container and refill the demolishers. *Other script-related fixes. --HG-- branch : trunk --- src/game/CreatureAI.cpp | 59 +++++-------------------------------------------- 1 file changed, 5 insertions(+), 54 deletions(-) (limited to 'src/game/CreatureAI.cpp') diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index 20acf216c82..53d9286fba7 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -125,42 +125,6 @@ void CreatureAI::SelectNearestTarget(Unit *who) } } -void CreatureAI::SetGazeOn(Unit *target) -{ - if(me->canAttack(target)) - { - AttackStart(target); - me->SetReactState(REACT_PASSIVE); - } -} - -bool CreatureAI::UpdateVictimWithGaze() -{ - if(!me->isInCombat()) - return false; - - if(me->HasReactState(REACT_PASSIVE)) - { - if(me->getVictim()) - return true; - else - me->SetReactState(REACT_AGGRESSIVE); - } - - if(Unit *victim = me->SelectVictim()) - AttackStart(victim); - return me->getVictim(); -} - -bool CreatureAI::UpdateVictim() -{ - if(!me->isInCombat()) - return false; - if(Unit *victim = me->SelectVictim()) - AttackStart(victim); - return me->getVictim(); -} - bool CreatureAI::UpdateCombatState() { if(!me->isInCombat()) @@ -181,26 +145,13 @@ bool CreatureAI::UpdateCombatState() return true; } -bool CreatureAI::_EnterEvadeMode() -{ - if(me->IsInEvadeMode() || !me->isAlive()) - return false; - - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->LoadCreaturesAddon(); - me->SetLootRecipient(NULL); - me->ResetPlayerDamageReq(); - - return true; -} - void CreatureAI::EnterEvadeMode() { if(!_EnterEvadeMode()) return; + sLog.outDebug("Creature %u enters evade mode.", me->GetEntry()); + if(!me->GetVehicle()) // otherwise me will be in evade mode forever { if(Unit *owner = me->GetCharmerOrOwner()) @@ -212,10 +163,10 @@ void CreatureAI::EnterEvadeMode() me->GetMotionMaster()->MoveTargetedHome(); } - if(me->IsVehicle()) - me->GetVehicleKit()->InstallAllAccessories(); - Reset(); + + if(me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons! + me->GetVehicleKit()->Reset(); } /*void CreatureAI::AttackedBy( Unit* attacker ) -- cgit v1.2.3