Fixes Fleeing, and probably so other movement stuff.
This commit is contained in:
@@ -67,10 +67,10 @@ namespace Game.Movement
|
||||
// start moving
|
||||
owner.AddUnitState(UnitState.ConfusedMove);
|
||||
|
||||
Position destination = _reference;
|
||||
Position destination = new(_reference);
|
||||
float distance = (float)(4.0f * RandomHelper.FRand(0.0f, 1.0f) - 2.0f);
|
||||
float angle = RandomHelper.FRand(0.0f, 1.0f) * MathF.PI * 2.0f;
|
||||
owner.MovePositionToFirstCollision(ref destination, distance, angle);
|
||||
owner.MovePositionToFirstCollision(destination, distance, angle);
|
||||
|
||||
if (_path == null)
|
||||
_path = new PathGenerator(owner);
|
||||
|
||||
@@ -99,8 +99,8 @@ namespace Game.Movement
|
||||
|
||||
owner.AddUnitState(UnitState.FleeingMove);
|
||||
|
||||
Position destination = owner.GetPosition();
|
||||
GetPoint(owner, ref destination);
|
||||
Position destination = new Position(owner.GetPosition());
|
||||
GetPoint(owner, destination);
|
||||
|
||||
// Add LOS check for target point
|
||||
if (!owner.IsWithinLOS(destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ()))
|
||||
@@ -127,7 +127,7 @@ namespace Game.Movement
|
||||
_timer.Reset(traveltime + RandomHelper.URand(800, 1500));
|
||||
}
|
||||
|
||||
void GetPoint(T owner, ref Position position)
|
||||
void GetPoint(T owner, Position position)
|
||||
{
|
||||
float casterDistance, casterAngle;
|
||||
Unit fleeTarget = Global.ObjAccessor.GetUnit(owner, _fleeTargetGUID);
|
||||
@@ -162,7 +162,7 @@ namespace Game.Movement
|
||||
angle = RandomHelper.FRand(0.0f, 2.0f * MathF.PI);
|
||||
}
|
||||
|
||||
owner.MovePositionToFirstCollision(ref position, distance, angle);
|
||||
owner.MovePositionToFirstCollision(position, distance, angle);
|
||||
}
|
||||
|
||||
public override MovementGeneratorType GetMovementGeneratorType()
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Game.Movement
|
||||
Position position = new(_reference);
|
||||
float distance = RandomHelper.FRand(0.0f, 1.0f) * _wanderDistance;
|
||||
float angle = RandomHelper.FRand(0.0f, 1.0f) * MathF.PI * 2.0f;
|
||||
owner.MovePositionToFirstCollision(ref position, distance, angle);
|
||||
owner.MovePositionToFirstCollision(position, distance, angle);
|
||||
|
||||
uint resetTimer = RandomHelper.randChance(50) ? RandomHelper.URand(5000, 10000) : RandomHelper.URand(1000, 2000);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user