hedgewars/uAIAmmoTests.pas
changeset 9495 2fc346fadae3
parent 9145 6b51a32e48ed
child 9521 8054d9d775fd
child 9722 22dba2d8de93
--- a/hedgewars/uAIAmmoTests.pas	Mon Oct 07 22:22:49 2013 +0400
+++ b/hedgewars/uAIAmmoTests.pas	Mon Oct 07 23:36:40 2013 +0400
@@ -22,13 +22,14 @@
 interface
 uses uConsts, uFloat, uTypes, uAIMisc;
 const
-    amtest_Rare     = $00000001; // check only several positions
-    amtest_NoTarget = $00000002; // each pos, but no targetting
+    amtest_Rare            = $00000001; // check only several positions
+    amtest_NoTarget        = $00000002; // each pos, but no targetting
+    amtest_MultipleAttacks = $00000004; // test could result in multiple attacks, set AttacksNum
 
 var windSpeed: real;
 
 type TAttackParams = record
-        Time: Longword;
+        Time, AttacksNum: Longword;
         Angle, Power: LongInt;
         ExplX, ExplY, ExplR: LongInt;
         AttackPutX, AttackPutY: LongInt;
@@ -72,7 +73,7 @@
             (proc: nil;              flags: 0), // amSkip
             (proc: nil;              flags: 0), // amRope
             (proc: nil;              flags: 0), // amMine
-            (proc: @TestDesertEagle; flags: 0), // amDEagle
+            (proc: @TestDesertEagle; flags: amtest_MultipleAttacks), // amDEagle
             (proc: nil;              flags: 0), // amDynamite
             (proc: @TestFirePunch;   flags: amtest_NoTarget), // amFirePunch
             (proc: @TestWhip;        flags: amtest_NoTarget), // amWhip
@@ -715,8 +716,13 @@
     or (d > 48);
 
 if Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 5 then
-     valueResult:= RateShove(Me, Targ.Point.X, Targ.Point.Y, 1, 7, 20, vX*0.125, vY*0.125, afTrackFall)
-else valueResult:= BadTurn;
+    begin
+    ap.AttacksNum:= 1 + (d + 8) div 12;
+    valueResult:= RateShove(Me, Targ.Point.X, Targ.Point.Y, 1, 7, 20, vX*0.125, vY*0.125, afTrackFall) - ap.AttacksNum
+    end
+else
+    valueResult:= BadTurn;
+
 TestDesertEagle:= valueResult
 end;