Show
Ignore:
Timestamp:
11/19/08 13:23:07 (17 years ago)
Author:
yumileroy
Message:

[svn] * Added fleeing and call assistance in script until we move all AI functions to core

Original author: Neo2003
Date: 2008-10-05 12:10:02-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Creature.cpp

    r6 r14  
    16451645} 
    16461646 
     1647void Creature::DoFleeToGetAssistance(float radius) // Optional parameter 
     1648{ 
     1649    if (!getVictim()) 
     1650        return; 
     1651 
     1652    Creature* pCreature = NULL; 
     1653 
     1654    CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); 
     1655    Cell cell(p); 
     1656    cell.data.Part.reserved = ALL_DISTRICT; 
     1657    cell.SetNoCreate(); 
     1658 
     1659    MaNGOS::NearestAssistCreatureInCreatureRangeCheck u_check(this,getVictim(),radius); 
     1660    MaNGOS::CreatureLastSearcher<MaNGOS::NearestAssistCreatureInCreatureRangeCheck> searcher(pCreature, u_check); 
     1661 
     1662    TypeContainerVisitor<MaNGOS::CreatureLastSearcher<MaNGOS::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer >  grid_creature_searcher(searcher); 
     1663 
     1664    CellLock<GridReadGuard> cell_lock(cell, p); 
     1665    cell_lock->Visit(cell_lock, grid_creature_searcher, *(GetMap())); 
     1666 
     1667    if(!GetMotionMaster()->empty() && (GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)) 
     1668        GetMotionMaster()->Clear(false); 
     1669    if(pCreature == NULL) 
     1670    { 
     1671        GetMotionMaster()->MoveIdle(); 
     1672        GetMotionMaster()->MoveFleeing(getVictim()); 
     1673    } 
     1674    else 
     1675    { 
     1676        GetMotionMaster()->MoveIdle(); 
     1677        GetMotionMaster()->MovePoint(0,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ()); 
     1678    } 
     1679} 
     1680 
    16471681void Creature::CallAssistence() 
    16481682{