hedgewars/uAIAmmoTests.pas
changeset 10015 4feced261c68
parent 9998 736015b847e3
parent 9950 2759212a27de
child 10097 acef073e190f
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
   245                 until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 22)
   245                 until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 22)
   246                     or (x < 0)
   246                     or (x < 0)
   247                     or (y < 0)
   247                     or (y < 0)
   248                     or (trunc(x) > LAND_WIDTH)
   248                     or (trunc(x) > LAND_WIDTH)
   249                     or (trunc(y) > LAND_HEIGHT)
   249                     or (trunc(y) > LAND_HEIGHT)
   250                     or not TestCollExcludingObjects(trunc(x), trunc(y), 5)
   250                     or (not TestCollExcludingObjects(trunc(x), trunc(y), 5))
   251                     or (timer = 0)
   251                     or (timer = 0)
   252                 end;
   252                 end;
   253             EX:= trunc(x);
   253             EX:= trunc(x);
   254             EY:= trunc(y);
   254             EY:= trunc(y);
   255             // Try to prevent AI from thinking firing into water will cause a drowning
   255             // Try to prevent AI from thinking firing into water will cause a drowning
   777     dx, dy: real;
   777     dx, dy: real;
   778 begin
   778 begin
   779     Targ:= Targ; // avoid compiler hint
   779     Targ:= Targ; // avoid compiler hint
   780 
   780 
   781     if Level < 3 then trackFall:= afTrackFall
   781     if Level < 3 then trackFall:= afTrackFall
   782     else trackFall:= 0;
   782         else trackFall:= 0;
   783 
   783 
   784     ap.ExplR:= 0;
   784     ap.ExplR:= 0;
   785     ap.Time:= 0;
   785     ap.Time:= 0;
   786     ap.Power:= 1;
   786     ap.Power:= 1;
   787     x:= hwRound(Me^.X);
   787     x:= hwRound(Me^.X);
  1239 repeat
  1239 repeat
  1240     dec(t);
  1240     dec(t);
  1241     x:= x + dx;
  1241     x:= x + dx;
  1242     dy:= dy + cGravityf;
  1242     dy:= dy + cGravityf;
  1243     y:= y + dy;
  1243     y:= y + dy;
  1244     
  1244 
  1245     if TestColl(trunc(x), trunc(y), 3) then
  1245     if TestColl(trunc(x), trunc(y), 3) then
  1246         t:= 0;
  1246         t:= 0;
  1247 until t = 0;
  1247 until t = 0;
  1248 
  1248 
  1249 EX:= trunc(x);
  1249 EX:= trunc(x);
  1250 EY:= trunc(y);
  1250 EY:= trunc(y);
  1251 
  1251 
  1252 if Level = 1 then
  1252 if Level = 1 then
  1253     valueResult:= RateExplosion(Me, EX, EY, 76, afTrackFall or afErasesLand)
  1253     valueResult:= RateExplosion(Me, EX, EY, 76, afTrackFall or afErasesLand)
  1254 else 
  1254 else
  1255     valueResult:= RateExplosion(Me, EX, EY, 76);
  1255     valueResult:= RateExplosion(Me, EX, EY, 76);
  1256 
  1256 
  1257 if (valueResult > 0) then
  1257 if (valueResult > 0) then
  1258     begin
  1258     begin
  1259     ap.Angle:= 0;
  1259     ap.Angle:= 0;