hedgewars/uAI.pas
changeset 15623 6c689729b745
parent 15603 ac44dae6425e
child 15632 25132742a948
--- a/hedgewars/uAI.pas	Sun Jun 21 03:00:39 2020 +0300
+++ b/hedgewars/uAI.pas	Sun Jun 21 03:08:21 2020 +0300
@@ -167,11 +167,6 @@
 
                     AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0);
 
-                    if (Ammoz[a].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
-                        begin
-                        AddAction(BestActions, aia_Put, 0, 8, ap.AttackPutX, ap.AttackPutY)
-                        end;
-
                     if (ap.Angle > 0) then
                         AddAction(BestActions, aia_LookRight, 0, 200, 0, 0)
                     else if (ap.Angle < 0) then
@@ -180,6 +175,18 @@
                     if (Ammoz[a].Ammo.Propz and ammoprop_Timerable) <> 0 then
                         AddAction(BestActions, aia_Timer, ap.Time div 1000, 400, 0, 0);
 
+                    if ((Ammoz[a].Ammo.Propz and ammoprop_SetBounce) > 0) and (ap.Bounce > 0) then
+                        begin
+                        AddAction(BestActions, aia_Precise, aim_push, 10, 0, 0);
+                        AddAction(BestActions, aia_Timer, ap.Bounce, 200, 0, 0);
+                        AddAction(BestActions, aia_Precise, aim_release, 10, 0, 0);
+                        end;
+
+                    if (Ammoz[a].Ammo.Propz and ammoprop_NeedTarget) <> 0 then
+                        begin
+                        AddAction(BestActions, aia_Put, 0, 8, ap.AttackPutX, ap.AttackPutY)
+                        end;
+
                     if (Ammoz[a].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
                         begin
                         dAngle:= LongInt(Me^.Angle) - Abs(ap.Angle);
@@ -247,7 +254,7 @@
 const FallPixForBranching = cHHRadius;
 var
     maxticks, oldticks, steps, tmp: Longword;
-    BaseRate, BestRate, Rate: LongInt;
+    BaseRate, BestRate, Rate, i: LongInt;
     GoInfo: TGoInfo;
     CanGo: boolean;
     AltMe: TGear;
@@ -321,6 +328,13 @@
                     AddAction(BestActions, aia_Weapon, Longword(amExtraTime), 80, 0, 0);
                     AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
                     AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
+                    // Better bot levels know they can spam extra time if infinite
+                    if (BotLevel < 3) and (HHHasAmmo(Me^.Hedgehog^, amExtraTime) = AMMO_INFINITE) then
+                        for i:= 1 to 3 do
+                            begin
+                            AddAction(BestActions, aia_attack, aim_push, 100, 0, 0);
+                            AddAction(BestActions, aia_attack, aim_release, 100, 0, 0);
+                            end;
                 end;
 
                 break;