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