hedgewars/uAIAmmoTests.pas
changeset 8862 85eb1f4b4a5f
parent 8824 fe9eacd390f2
child 8895 95177c18e38c
equal deleted inserted replaced
8858:b216fe93bab1 8862:85eb1f4b4a5f
   247                     or not TestCollWithLand(trunc(x), trunc(y), 5)
   247                     or not TestCollWithLand(trunc(x), trunc(y), 5)
   248                     or (timer = 0)
   248                     or (timer = 0)
   249                 end;
   249                 end;
   250             EX:= trunc(x);
   250             EX:= trunc(x);
   251             EY:= trunc(y);
   251             EY:= trunc(y);
       
   252             // Try to prevent AI from thinking firing into water will cause a drowning
       
   253             if (EY < cWaterLine-5) and (Timer > 0) and (Abs(Targ.X - trunc(x)) + Abs(Targ.Y - trunc(y)) > 21) then exit(BadTurn);
   252             if Level = 1 then
   254             if Level = 1 then
   253                 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   255                 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   254             else value:= RateExplosion(Me, EX, EY, 101);
   256             else value:= RateExplosion(Me, EX, EY, 101);
   255             if valueResult <= value then
   257             if valueResult <= value then
   256                 begin
   258                 begin