Show
Ignore:
Timestamp:
11/22/08 00:35:41 (17 years ago)
Author:
yumileroy
Message:

Delete possessed AI only on creature delete.

Original author: gvcoman
Date: 2008-11-16 14:38:02-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/bindings/scripts/include/sc_creature.cpp

    r267 r272  
    7474void ScriptedAI::MoveInLineOfSight(Unit *who) 
    7575{ 
    76     if(!m_creature->getVictim() && m_creature->canStartAttack(who)) 
     76    if(m_creature->getVictim() || !m_creature->IsHostileTo(who) || !who->isInAccessiblePlaceFor(m_creature)) 
     77        return; 
     78 
     79    if(!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 
     80        return; 
     81 
     82    if(!m_creature->IsWithinDistInMap(who, m_creature->GetAttackDistance(who)) || !m_creature->IsWithinLOSInMap(who)) 
     83        return; 
     84     
     85    if(m_creature->canAttack(who)) 
     86        //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 
    7787        AttackStart(who); 
    7888} 
     
    670680    } 
    671681 
    672     Map::PlayerList const &PlayerList = map->GetPlayers(); 
    673     for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) 
    674         if (Player* i_pl = i->getSource()) 
    675             if (!i_pl->isAlive()) 
    676                 pUnit->AddThreat(i_pl, 0.0f); 
     682    InstanceMap::PlayerList const &PlayerList = ((InstanceMap*)map)->GetPlayers(); 
     683    InstanceMap::PlayerList::const_iterator i; 
     684    for (i = PlayerList.begin(); i != PlayerList.end(); ++i) 
     685    { 
     686        if((*i)->isAlive()) 
     687            pUnit->AddThreat(*i, 0.0f); 
     688    } 
    677689} 
    678690 
     
    709721    ((Player*)pUnit)->TeleportTo(pUnit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); 
    710722} 
    711  
    712 void ScriptedAI::DoTeleportAll(float x, float y, float z, float o) 
    713 { 
    714     Map *map = m_creature->GetMap(); 
    715     if (!map->IsDungeon()) 
    716         return; 
    717  
    718     Map::PlayerList const &PlayerList = map->GetPlayers(); 
    719     for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) 
    720         if (Player* i_pl = i->getSource()) 
    721             if (!i_pl->isAlive()) 
    722                 i_pl->TeleportTo(m_creature->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); 
    723 } 
    724  
    725723 
    726724Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)