Index: trunk/src/game/Object.cpp
===================================================================
--- trunk/src/game/Object.cpp (revision 138)
+++ trunk/src/game/Object.cpp (revision 141)
@@ -1533,12 +1533,2 @@
 	UpdateGroundPositionZ(x,y,z);
 }
-
-void WorldObject::GetRandomContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const
-{
-	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.
-	//let assume 12.0f is the max size for object to have 0 angle offset.
-	float angle_offset_ratio = 1 - object_size/12.0f;
-	if (angle_offset_ratio < 0.05) angle_offset_ratio = 0.05;
-	// 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`
-	GetNearPoint(obj,x,y,z,object_size,distance2dMin+(distance2dMax-distance2dMin)*rand_norm(), GetAngle( obj ) + (M_PI/2 - M_PI * rand_norm()) * angle_offset_ratio);
-}
Index: trunk/src/game/SpellEffects.cpp
===================================================================
--- trunk/src/game/SpellEffects.cpp (revision 136)
+++ trunk/src/game/SpellEffects.cpp (revision 141)
@@ -1983,22 +1983,8 @@
             return;
         }
-        case TARGET_TABLE_X_Y_Z_COORDINATES:
-        {
-            // TODO: Only players can teleport?
-            if (unitTarget->GetTypeId() != TYPEID_PLAYER)
-                return;
-            SpellTargetPosition const* st = spellmgr.GetSpellTargetPosition(m_spellInfo->Id);
-            if(!st)
-            {
-                sLog.outError( "Spell::EffectTeleportUnits - unknown Teleport coordinates for spell ID %u\n", m_spellInfo->Id );
-                return;
-            }
-            ((Player*)unitTarget)->TeleportTo(st->target_mapId,st->target_X,st->target_Y,st->target_Z,st->target_Orientation,unitTarget==m_caster ? TELE_TO_SPELL : 0);
-            break;
-        }
         default:
         {
             // If not exist data for dest location - return
-            if(!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
+            if(!m_targets.HasDest())
             {
                 sLog.outError( "Spell::EffectTeleportUnits - unknown EffectImplicitTargetB[%u] = %u for spell ID %u\n", i, m_spellInfo->EffectImplicitTargetB[i], m_spellInfo->Id );
Index: trunk/src/game/Object.h
===================================================================
--- trunk/src/game/Object.h (revision 120)
+++ trunk/src/game/Object.h (revision 141)
@@ -378,5 +378,4 @@
             GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle( obj ));
         }
-        void GetRandomContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const;
 
         float GetObjectSize() const
Index: trunk/src/game/TargetedMovementGenerator.cpp
===================================================================
--- trunk/src/game/TargetedMovementGenerator.cpp (revision 118)
+++ trunk/src/game/TargetedMovementGenerator.cpp (revision 141)
@@ -61,5 +61,5 @@
     {
         // to nearest random contact position 
-        i_target->GetRandomContactPoint( &owner, x, y, z,0.5f,4.5f );
+        i_target->GetRandomContactPoint( &owner, x, y, z, 0.5f, ATTACK_DISTANCE - 0.5f );
     }
     else
@@ -165,5 +165,5 @@
             i_destinationHolder.ResetUpdate(50);
 
-        float dist = i_target->GetObjectSize() + owner.GetObjectSize() + sWorld.getRate(RATE_TARGET_POS_RECALCULATION_RANGE);
+        float dist = owner.GetFloatValue(UNIT_FIELD_COMBATREACH) + i_target.getTarget()->GetFloatValue(UNIT_FIELD_COMBATREACH) + sWorld.getRate(RATE_TARGET_POS_RECALCULATION_RANGE);
 
         //More distance let have better performance, less distance let have more sensitive reaction at target move.
@@ -186,5 +186,5 @@
 
             owner.StopMoving();
-            if(owner.canReachWithAttack(i_target.getTarget()) && !owner.hasUnitState(UNIT_STAT_FOLLOW))
+            if(owner.IsWithinCombatDist(i_target.getTarget(), ATTACK_DISTANCE) && !owner.hasUnitState(UNIT_STAT_FOLLOW))
                 owner.Attack(i_target.getTarget(),true);
         }
Index: trunk/src/game/Unit.h
===================================================================
--- trunk/src/game/Unit.h (revision 136)
+++ trunk/src/game/Unit.h (revision 141)
@@ -722,4 +722,5 @@
         bool canReachWithAttack(Unit *pVictim) const;
         bool IsWithinCombatDist(Unit *obj, float dist2compare) const;
+        void GetRandomContactPoint( const Unit* target, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const;
         uint32 m_extraAttacks;
         bool m_canDualWield;
Index: trunk/src/game/Unit.cpp
===================================================================
--- trunk/src/game/Unit.cpp (revision 140)
+++ trunk/src/game/Unit.cpp (revision 141)
@@ -421,8 +421,16 @@
     float distsq = dx*dx + dy*dy + dz*dz;
     //not sure here, or combatreach + combatreach?
-    float sizefactor = GetObjectSize() + obj->GetFloatValue(UNIT_FIELD_COMBATREACH);
+    float sizefactor = GetFloatValue(UNIT_FIELD_COMBATREACH) + obj->GetFloatValue(UNIT_FIELD_COMBATREACH);
     float maxdist = dist2compare + sizefactor;
 
     return distsq < maxdist * maxdist;
+}
+
+void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const
+{
+	uint32 attacker_number = getAttackers().size();
+    if(attacker_number > 0) --attacker_number;
+	GetNearPoint(obj,x,y,z,obj->GetFloatValue(UNIT_FIELD_COMBATREACH),distance2dMin+(distance2dMax-distance2dMin)*rand_norm()
+        , GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * (float)attacker_number / GetFloatValue(UNIT_FIELD_COMBATREACH) / 3 : 0));
 }
 
Index: trunk/src/game/Spell.cpp
===================================================================
--- trunk/src/game/Spell.cpp (revision 140)
+++ trunk/src/game/Spell.cpp (revision 141)
@@ -1444,5 +1444,4 @@
 
         // area targets
-		case TARGET_AREAEFFECT_CUSTOM:
         case TARGET_ALL_ENEMY_IN_AREA_INSTANT:
             if(m_spellInfo->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
@@ -1457,6 +1456,6 @@
             SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY);
             break;
-        //case TARGET_AREAEFFECT_CUSTOM:
-        //    m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION;
+        case TARGET_AREAEFFECT_CUSTOM:
+            m_targets.m_targetMask |= TARGET_FLAG_DEST_LOCATION;
         case TARGET_UNIT_AREA_ENTRY:
         {
@@ -1465,5 +1464,6 @@
             if(lower==upper)
             {
-                sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT, but does not have record in `spell_script_target`",m_spellInfo->Id);
+                SearchAreaTarget(TagUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE);
+                //sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = TARGET_SCRIPT, but does not have record in `spell_script_target`",m_spellInfo->Id);
                 break;
             }
Index: trunk/src/game/Map.cpp
===================================================================
--- trunk/src/game/Map.cpp (revision 120)
+++ trunk/src/game/Map.cpp (revision 141)
@@ -1420,34 +1420,34 @@
 bool InstanceMap::CanEnter(Player *player)
 {
-    if(!player->isGameMaster() && i_data && i_data->IsEncounterInProgress())
+    if(std::find(i_Players.begin(),i_Players.end(),player)!=i_Players.end())
+    {
+        sLog.outError("InstanceMap::CanEnter - player %s(%u) already in map %d,%d,%d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
+        assert(false);
+        return false;
+    }
+
+    // cannot enter if the instance is full (player cap), GMs don't count
+    InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId());
+    if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= iTemplate->maxPlayers)
+    {
+        sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), iTemplate->maxPlayers, player->GetName());
+        player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
+        return false;
+    }
+
+    // cannot enter while players in the instance are in combat
+    Group *pGroup = player->GetGroup();
+    if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->isAlive() && player->GetMapId() != GetId())
+    {
+        player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
+        return false;
+    }
+
+    /*if(!player->isGameMaster() && i_data && i_data->IsEncounterInProgress())
     {
         sLog.outDebug("InstanceMap::CanEnter - Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), GetMapName());
         player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
         return false;
-    }
-
-    if(std::find(i_Players.begin(),i_Players.end(),player)!=i_Players.end())
-    {
-        sLog.outError("InstanceMap::CanEnter - player %s(%u) already in map %d,%d,%d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
-        assert(false);
-        return false;
-    }
-
-    // cannot enter if the instance is full (player cap), GMs don't count
-    InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId());
-    if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= iTemplate->maxPlayers)
-    {
-        sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), iTemplate->maxPlayers, player->GetName());
-        player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
-        return false;
-    }
-
-    // cannot enter while players in the instance are in combat
-    Group *pGroup = player->GetGroup();
-    if(pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->isAlive() && player->GetMapId() != GetId())
-    {
-        player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
-        return false;
-    }
+    }*/
 
     return Map::CanEnter(player);
