--- a/hedgewars/uAIAmmoTests.pas Mon Jun 08 23:37:38 2020 +0200
+++ b/hedgewars/uAIAmmoTests.pas Tue Jun 09 05:51:39 2020 +0200
@@ -482,6 +482,10 @@
(((ap.Angle < 0) and (windSpeed > 0)) or ((ap.Angle > 0) and (windSpeed < 0))) then
exit(BadTurn);
+ // Apply inaccuracy
+ if (not cLaserSighting) then
+ inc(ap.Angle, + AIrndSign(random((Level - 1) * 9)));
+
if (valueResult <= 0) then
valueResult:= BadTurn;
exit(valueResult)
@@ -936,6 +940,9 @@
Vx:= (Targ.Point.X - x) * 1 / 1024;
Vy:= (Targ.Point.Y - y) * 1 / 1024;
ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);
+// Apply inaccuracy
+if (not cLaserSighting) then
+ inc(ap.Angle, + AIrndSign(random((Level - 1) * 10)));
repeat
x:= x + vX;
y:= y + vY;
@@ -990,6 +997,9 @@
Vx:= (Targ.Point.X - x) * t;
Vy:= (Targ.Point.Y - y) * t;
ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);
+// Apply inaccuracy
+if (not cLaserSighting) then
+ inc(ap.Angle, + AIrndSign(random((Level - 1) * 10)));
d:= 0;
ix:= trunc(x);
@@ -1044,6 +1054,9 @@
Vx:= (Targ.Point.X - x) * t;
Vy:= (Targ.Point.Y - y) * t;
ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);
+// Apply inaccuracy
+inc(ap.Angle, + AIrndSign(random((Level - 1) * 5)));
+
d:= 0;
repeat
@@ -1270,6 +1283,9 @@
dy:= (Targ.Point.Y - y) * t;
ap.Angle:= DxDy2AttackAnglef(dx, -dy)
+ // Apply inaccuracy
+ if (not cLaserSighting) then
+ inc(ap.Angle, + AIrndSign(random((Level - 1) * 10)));
end;
if dx >= 0 then cx:= 0.45 else cx:= -0.45;