Teach AI to spam extra time if infinite
authorWuzzy <Wuzzy2@mail.ru>
Sat, 06 Jun 2020 16:09:16 +0200
changeset 15599 dc62f1c13bb2
parent 15598 d275bb6b85b4
child 15600 7d3877231b00
Teach AI to spam extra time if infinite
hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Sat Jun 06 15:43:17 2020 +0200
+++ b/hedgewars/uAI.pas	Sat Jun 06 16:09:16 2020 +0200
@@ -247,7 +247,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 +321,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;