Changeset 118
- Timestamp:
- 11/19/08 13:37:52 (17 years ago)
- Location:
- trunk/src
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bindings/scripts/include/sc_creature.cpp
r113 r118 93 93 { 94 94 //If we are within range melee the target 95 if (m_creature->IsWithin DistInMap(m_creature->getVictim(), ATTACK_DISTANCE))95 if (m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE)) 96 96 { 97 97 m_creature->AttackerStateUpdate(m_creature->getVictim()); … … 149 149 { 150 150 //If we are within range melee the target 151 if (m_creature->IsWithin DistInMap(m_creature->getVictim(), ATTACK_DISTANCE))151 if (m_creature->IsWithinCombatDist(m_creature->getVictim(), ATTACK_DISTANCE)) 152 152 { 153 153 m_creature->AttackerStateUpdate(m_creature->getVictim()); -
trunk/src/game/Map.cpp
r102 r118 1420 1420 bool InstanceMap::CanEnter(Player *player) 1421 1421 { 1422 if(!player->isGameMaster() && i_data && i_data->IsEncounterInProgress()) 1423 { 1424 sLog.outDebug("InstanceMap::CanEnter - Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), GetMapName()); 1425 player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); 1426 return false; 1427 } 1428 1422 1429 if(std::find(i_Players.begin(),i_Players.end(),player)!=i_Players.end()) 1423 1430 { -
trunk/src/game/Object.h
r102 r118 373 373 GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle( obj )); 374 374 } 375 void GetRandomContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const 376 { 377 float object_size = obj->GetObjectSize();//here we use object_size to determine the angle offset, the bigger object the smaller angle offset, then this makes mob move naturally in visual. 378 //let assume 12.0f is the max size for object to have 0 angle offset. 379 float angle_offset_ratio = 1 - object_size/12.0f; 380 if (angle_offset_ratio < 0.05) angle_offset_ratio = 0.05; 381 // angle to face `obj` to `this`plus a random angle offset(from -90 degree to 90 degree)*angle_offset_ratio using distance from distance2dMin to distance2dMax includes size of `obj` 382 GetNearPoint(obj,x,y,z,object_size,distance2dMin+(distance2dMax-distance2dMin)*rand_norm(), GetAngle( obj ) + (M_PI_2 - M_PI * rand_norm()) * angle_offset_ratio); 383 } 375 384 376 385 float GetObjectSize() const -
trunk/src/game/TargetedMovementGenerator.cpp
r102 r118 60 60 if(!i_offset) 61 61 { 62 // to nearest contact position63 i_target->Get ContactPoint( &owner, x, y, z);62 // to nearest random contact position 63 i_target->GetRandomContactPoint( &owner, x, y, z,0.5f,4.5f ); 64 64 } 65 65 else