hedgewars/uGearsHandlersMess.pas
changeset 10802 089e43d01f74
parent 10800 3c71e5158519
child 10806 02ef8815ec9d
--- a/hedgewars/uGearsHandlersMess.pas	Mon Jan 19 00:12:26 2015 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Sun Jan 18 16:57:32 2015 -0500
@@ -1783,13 +1783,15 @@
         tX:=Gear^.X-targ^.X;
         tY:=Gear^.Y-targ^.Y;
         // allow escaping - should maybe flag this too
-        if ((tX.Round+tY.Round > Gear^.Angle*4) and
-            (hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*4))) then
+        if (GameTicks > Gear^.FlightTime+10000) or 
+            ((tX.Round+tY.Round > Gear^.Angle*6) and
+            (hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*6))) then
             targ:= nil
         end;
 
     // todo, allow not finding new target, set timeout on target retention
-    if (Gear^.State and (gsttmpFlag or gstAttacking) =  gsttmpFlag) and
+    if (ReadyTimeLeft = 0) and (TurnTimeLeft > 0) and ((TurnTimeLeft > cHedgehogTurnTime) or (cHedgehogTurnTime-TurnTimeLeft > 5000)) and
+       (Gear^.State and (gsttmpFlag or gstAttacking) =  gsttmpFlag) and
        (Gear^.Angle > 0) and ((GameTicks and $FF) = 17) and
        (GameTicks > Gear^.FlightTime) then // recheck hunted hog
         begin
@@ -1818,7 +1820,7 @@
                                 end
                             end
                         end;
-        if targ <> nil then Gear^.FlightTime:= GameTicks + 10000
+        if targ <> nil then Gear^.FlightTime:= GameTicks + 5000
         end;
     if targ <> nil then
         begin
@@ -1831,7 +1833,7 @@
         if (Gear^.Y < targ^.Y) and (Gear^.dY < _0_1)  then
              Gear^.dY:= Gear^.dY+trackSpeed
         else if (Gear^.Y > targ^.Y) and (Gear^.dY > -_0_1) then
-            Gear^.dY:= Gear^.dY-trackSpeed;
+            Gear^.dY:= Gear^.dY-trackSpeed
         end
     else Gear^.Hedgehog:= nil;