Changeset 272 for trunk/src/bindings/scripts/include/sc_creature.cpp
- Timestamp:
- 11/22/08 00:35:41 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bindings/scripts/include/sc_creature.cpp
r267 r272 74 74 void ScriptedAI::MoveInLineOfSight(Unit *who) 75 75 { 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); 77 87 AttackStart(who); 78 88 } … … 670 680 } 671 681 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 } 677 689 } 678 690 … … 709 721 ((Player*)pUnit)->TeleportTo(pUnit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); 710 722 } 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 725 723 726 724 Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)