hedgewars/uGearsHandlersMess.pas
changeset 10807 66cde98f8cbe
parent 10806 02ef8815ec9d
child 10815 2a85c551909c
equal deleted inserted replaced
10806:02ef8815ec9d 10807:66cde98f8cbe
  1790             ((tX.Round+tY.Round > Gear^.Angle*6) and
  1790             ((tX.Round+tY.Round > Gear^.Angle*6) and
  1791             (hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*6))) then
  1791             (hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*6))) then
  1792             targ:= nil
  1792             targ:= nil
  1793         end;
  1793         end;
  1794 
  1794 
       
  1795     // If in ready timer, or after turn, or in first 5 seconds of turn (really a window due to extra time utility)
       
  1796     // or mine is inactive due to lack of gsttmpflag or hunting is disabled due to seek radius of 0
       
  1797     // then we aren't hunting
       
  1798     if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or 
       
  1799         ((TurnTimeLeft < cHedgehogTurnTime) and (cHedgehogTurnTime-TurnTimeLeft < 5000)) or
       
  1800         (Gear^.State and gsttmpFlag = 0) or
       
  1801         (Gear^.Angle = 0) then
       
  1802         gear^.State:= gear^.State and not gstHHChooseTarget
       
  1803     else if
  1795     // todo, allow not finding new target, set timeout on target retention
  1804     // todo, allow not finding new target, set timeout on target retention
  1796     if (ReadyTimeLeft = 0) and (TurnTimeLeft > 0) and ((TurnTimeLeft > cHedgehogTurnTime) or (cHedgehogTurnTime-TurnTimeLeft > 5000)) and
  1805         (Gear^.State and gstAttacking = 0) and
  1797        (Gear^.State and (gsttmpFlag or gstAttacking) =  gsttmpFlag) and
  1806         ((GameTicks and $FF) = 17) and
  1798        (Gear^.Angle > 0) and ((GameTicks and $FF) = 17) and
  1807         (GameTicks > Gear^.FlightTime) then // recheck hunted hog
  1799        (GameTicks > Gear^.FlightTime) then // recheck hunted hog
  1808         begin
  1800         begin
  1809         gear^.State:= gear^.State or gstHHChooseTarget;
  1801         if targ <> nil then
  1810         if targ <> nil then
  1802              targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round
  1811              targDist:= Distance(Gear^.X-targ^.X,Gear^.Y-targ^.Y).Round
  1803         else targDist:= 0;
  1812         else targDist:= 0;
  1804         for t:= 0 to Pred(TeamsCount) do
  1813         for t:= 0 to Pred(TeamsCount) do
  1805             with TeamsArray[t]^ do
  1814             with TeamsArray[t]^ do