Make AI more active in multiattack game mode
authorunc0rr
Thu, 02 May 2013 21:55:03 +0400
changeset 8946 3e07b8ff2ae1
parent 8944 ed2509832311
child 8947 e906ebd59612
Make AI more active in multiattack game mode
hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Wed May 01 04:05:10 2013 +0300
+++ b/hedgewars/uAI.pas	Thu May 02 21:55:03 2013 +0400
@@ -377,7 +377,7 @@
     switchCount:= HHHasAmmo(PGear(Me)^.Hedgehog^, amSwitch)
 else switchCount:= 0;
 
-if (Me^.State and gstAttacked) = 0 then
+if ((Me^.State and gstAttacked) = 0) or isInMultiShoot then
     if Targets.Count > 0 then
         begin
         // iterate over current team hedgehogs
@@ -426,7 +426,8 @@
 else
     begin
     BackMe:= Me^;
-    while (not StopThinking) and (BestActions.Count = 0) do
+    i:= 12;
+    while (not StopThinking) and (BestActions.Count = 0) and (i > 0) do
         begin
 (*
         // Maybe this would get a bit of movement out of them? Hopefully not *toward* water. Need to check how often he'd choose that strategy
@@ -439,6 +440,7 @@
         Actions.Pos:= 0;
         Actions.Score:= 0;
         Walk(@WalkMe, Actions);
+        dec(i);
         if not StopThinking then
             SDL_Delay(100)
         end
@@ -477,7 +479,7 @@
     exit
     end;
 
-FillBonuses((Me^.State and gstAttacked) <> 0);
+FillBonuses(((Me^.State and gstAttacked) <> 0) and (not isInMultiShoot));
 
 SDL_LockMutex(ThreadLock);
 ThinkThread:= SDL_CreateThread(@Think{$IFDEF SDL13}, 'think'{$ENDIF}, Me);