Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
authornemo
Sat, 07 Jul 2012 15:28:47 -0400
changeset 7348 2a69f2ed9273
parent 7345 f253e225da15
child 7351 34efdd1f230f
Limit firepunch/whip drowning checks to max AI, bat to top 2 levels.
hedgewars/uAIAmmoTests.pas
--- a/hedgewars/uAIAmmoTests.pas	Sat Jul 07 14:29:35 2012 -0400
+++ b/hedgewars/uAIAmmoTests.pas	Sat Jul 07 15:28:47 2012 -0400
@@ -694,9 +694,11 @@
 
 function TestBaseballBat(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
 var valueResult, a, v1, v2: LongInt;
-    x, y: LongInt;
+    x, y, trackFall: LongInt;
     dx, dy: real;
 begin
+    if Me^.Hedgehog^.BotLevel < 3 then trackFall:= afTrackFall
+    else trackFall:= 0;
     Level:= Level; // avoid compiler hint
     ap.ExplR:= 0;
     ap.Time:= 0;
@@ -714,10 +716,10 @@
 
         v1:= RateShove(Me, x - 10, y
                 , 33, 30, 115
-                , -dx, -dy, afTrackFall);
+                , -dx, -dy, trackFall);
         v2:= RateShove(Me, x + 10, y
                 , 33, 30, 115
-                , dx, -dy, afTrackFall);
+                , dx, -dy, trackFall);
         if (v1 > valueResult) or (v2 > valueResult) then
             if (v2 > v1) 
                 or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
@@ -742,8 +744,10 @@
 
 function TestFirePunch(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
 var valueResult, v1, v2, i: LongInt;
-    x, y: LongInt;
+    x, y, trackFall: LongInt;
 begin
+    if Me^.Hedgehog^.BotLevel = 1 then trackFall:= afTrackFall
+    else trackFall:= 0;
     Level:= Level; // avoid compiler hint
     ap.ExplR:= 0;
     ap.Time:= 0;
@@ -756,11 +760,11 @@
         begin
         v1:= v1 + RateShove(Me, x - 10, y - 10 * i
                 , 18, 30, 40
-                , -0.45, -0.9, afTrackFall or afSetSkip);
+                , -0.45, -0.9, trackFall or afSetSkip);
         end;
     v1:= v1 + RateShove(Me, x - 10, y - 90
             , 18, 30, 40
-            , -0.45, -0.9, afTrackFall);
+            , -0.45, -0.9, trackFall);
 
 
     // now try opposite direction
@@ -769,11 +773,11 @@
         begin
         v2:= v2 + RateShove(Me, x + 10, y - 10 * i
                 , 18, 30, 40
-                , 0.45, -0.9, afTrackFall or afSetSkip);
+                , 0.45, -0.9, trackFall or afSetSkip);
         end;
     v2:= v2 + RateShove(Me, x + 10, y - 90
             , 18, 30, 40
-            , 0.45, -0.9, afTrackFall);
+            , 0.45, -0.9, trackFall);
 
     if (v2 > v1) 
         or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then
@@ -796,8 +800,10 @@
 
 function TestWhip(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
 var valueResult, v1, v2: LongInt;
-    x, y: LongInt;
+    x, y, trackFall: LongInt;
 begin
+    if Me^.Hedgehog^.BotLevel = 1 then trackFall:= afTrackFall
+    else trackFall:= 0;
     Level:= Level; // avoid compiler hint
     ap.ExplR:= 0;
     ap.Time:= 0;
@@ -811,19 +817,19 @@
     RateShove call)}
     v1:= RateShove(Me, x - 15, y
             , 30, 30, 25
-            , -1, -0.8, afTrackFall or afSetSkip);
+            , -1, -0.8, trackFall or afSetSkip);
     v1:= v1 +
         RateShove(Me, x, y
             , 30, 30, 25
-            , -1, -0.8, afTrackFall);
+            , -1, -0.8, trackFall);
     // now try opposite direction
     v2:= RateShove(Me, x + 15, y
             , 30, 30, 25
-            , 1, -0.8, afTrackFall or afSetSkip);
+            , 1, -0.8, trackFall or afSetSkip);
     v2:= v2 +
         RateShove(Me, x, y
             , 30, 30, 25
-            , 1, -0.8, afTrackFall);
+            , 1, -0.8, trackFall);
 
     if (v2 > v1) 
         or {don't encourage turning for no gain}((v2 = v1) and (not Me^.dX.isNegative)) then