hedgewars/uAIAmmoTests.pas
changeset 10637 13a5dd92ebf9
parent 10108 c68cf030eded
child 10789 acbf69e2e5cf
equal deleted inserted replaced
10636:aba9ae27ead0 10637:13a5dd92ebf9
   209     mY:= hwFloat2Float(Me^.Y);
   209     mY:= hwFloat2Float(Me^.Y);
   210     ap.Time:= 0;
   210     ap.Time:= 0;
   211     rTime:= 350;
   211     rTime:= 350;
   212     ap.ExplR:= 0;
   212     ap.ExplR:= 0;
   213     valueResult:= BadTurn;
   213     valueResult:= BadTurn;
       
   214     timer:= 0;
   214     repeat
   215     repeat
   215         rTime:= rTime + 300 + Level * 50 + random(300);
   216         rTime:= rTime + 300 + Level * 50 + random(300);
   216         Vx:= - windSpeed * rTime * 0.5 + (Targ.Point.X + AIrndSign(2) - mX) / rTime;
   217         Vx:= - windSpeed * rTime * 0.5 + (Targ.Point.X + AIrndSign(2) - mX) / rTime;
   217         Vy:= cGravityf * rTime * 0.5 - (Targ.Point.Y - 35 - mY) / rTime;
   218         Vy:= cGravityf * rTime * 0.5 - (Targ.Point.Y - 35 - mY) / rTime;
   218         r:= sqr(Vx) + sqr(Vy);
   219         r:= sqr(Vx) + sqr(Vy);
   251                     or (timer = 0)
   252                     or (timer = 0)
   252                 end;
   253                 end;
   253             EX:= trunc(x);
   254             EX:= trunc(x);
   254             EY:= trunc(y);
   255             EY:= trunc(y);
   255             // Try to prevent AI from thinking firing into water will cause a drowning
   256             // Try to prevent AI from thinking firing into water will cause a drowning
   256             if (EY < cWaterLine-5) and (Timer > 0) and (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) > 21) then exit(BadTurn);
   257             if (EY < cWaterLine-5) and (timer > 0) and (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) > 21) then exit(BadTurn);
   257             if Level = 1 then
   258             if Level = 1 then
   258                 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   259                 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
   259             else value:= RateExplosion(Me, EX, EY, 101);
   260             else value:= RateExplosion(Me, EX, EY, 101);
   260             if valueResult <= value then
   261             if valueResult <= value then
   261                 begin
   262                 begin