From 6bc64bf5c42cbd1e491c28a4d7a2bf91051323fb Mon Sep 17 00:00:00 2001 From: H0zen Date: Tue, 17 May 2016 09:13:07 +0300 Subject: [PATCH] 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. --- src/game/Object/Object.cpp | 4 ---- src/game/Object/Object.h | 2 +- src/game/Object/Unit.cpp | 2 +- src/game/movement/MoveSplineInit.h | 15 ++++++++------- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/game/Object/Object.cpp b/src/game/Object/Object.cpp index cd9adcd9..332e5e5d 100644 --- a/src/game/Object/Object.cpp +++ b/src/game/Object/Object.cpp @@ -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; diff --git a/src/game/Object/Object.h b/src/game/Object/Object.h index ddaf3809..565bf64c 100644 --- a/src/game/Object/Object.h +++ b/src/game/Object/Object.h @@ -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; } diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index 1ad68abf..ef36e2e4 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -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(); } diff --git a/src/game/movement/MoveSplineInit.h b/src/game/movement/MoveSplineInit.h index da7cccad..6af43a44 100644 --- a/src/game/movement/MoveSplineInit.h +++ b/src/game/movement/MoveSplineInit.h @@ -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; } /**