Fix Charge bug (#125)

* Fix "You are in combat" bug.

Ideas taken from TC

* Correct previous commit.

* Improved previous commits

- Creatures in dungeons will not remove distant players from their threat list
- Creatures in non dungeon maps will properly remove the distant players from their threat lists and also players auras from them

* Fix previous commit.

  -The creatures will remain tapped by the initial attacker.
  -Fix the loot bug

* Fix Charge bug.

  -Corrected WorldObject::GetContactPoint to proper compute the final destination point.
  -Corrected WorldObject::UpdateAllowedPositionZ to proper adjust the Z value
  -Limit the path length computed for EffectCharge. In the event the path cannot be computed, a linear path is applied.
This commit is contained in:
H0zen 2016-05-17 09:13:07 +03:00 committed by Antz
parent 105ded0cda
commit 6bc64bf5c4
4 changed files with 10 additions and 13 deletions

View File

@ -1315,8 +1315,6 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
{
if (z > max_z)
{ z = max_z; }
else if (z < ground_z)
{ z = ground_z; }
}
}
else
@ -1337,8 +1335,6 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
{
if (z > max_z)
{ z = max_z; }
else if (z < ground_z)
{ z = ground_z; }
}
}
break;

View File

@ -533,7 +533,7 @@ class WorldObject : public Object
void GetContactPoint(const WorldObject* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const
{
// angle to face `obj` to `this` using distance includes size of `obj`
GetNearPoint(obj, x, y, z, obj->GetObjectBoundingRadius(), distance2d + GetObjectBoundingRadius() + obj->GetObjectBoundingRadius(), GetAngle(obj));
GetNearPoint(obj, x, y, z, obj->GetObjectBoundingRadius(), distance2d, GetAngle(obj));
}
virtual float GetObjectBoundingRadius() const { return DEFAULT_WORLD_OBJECT_SIZE; }

View File

@ -9169,7 +9169,7 @@ void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool cas
void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath, bool forceDestination)
{
Movement::MoveSplineInit init(*this);
init.MoveTo(x, y, z, generatePath, forceDestination);
init.MoveTo(x, y, z, generatePath, forceDestination, 30.f);
init.SetVelocity(speed);
init.Launch();
}

View File

@ -237,14 +237,15 @@ namespace Movement
path.setPathLengthLimit(maxPathRange);
}
path.calculate(dest.x, dest.y, dest.z, forceDestination);
MovebyPath(path.getPath());
}
else
{
args.path_Idx_offset = 0;
args.path.resize(2);
args.path[1] = dest;
if (!(path.getPathType() & PATHFIND_NOPATH))
{
MovebyPath(path.getPath());
return;
}
}
args.path_Idx_offset = 0;
args.path.resize(2);
args.path[1] = dest;
}
/**