hedgewars/uAI.pas
branchwebgl
changeset 9521 8054d9d775fd
parent 9127 e350500c4edb
parent 9495 2fc346fadae3
child 9950 2759212a27de
equal deleted inserted replaced
9282:92af50454cf2 9521:8054d9d775fd
   109 
   109 
   110 
   110 
   111 procedure TestAmmos(var Actions: TActions; Me: PGear; rareChecks: boolean);
   111 procedure TestAmmos(var Actions: TActions; Me: PGear; rareChecks: boolean);
   112 var BotLevel: Byte;
   112 var BotLevel: Byte;
   113     ap: TAttackParams;
   113     ap: TAttackParams;
   114     Score, i, dAngle: LongInt;
   114     Score, i, t, n, dAngle: LongInt;
   115     a, aa: TAmmoType;
   115     a, aa: TAmmoType;
   116 begin
   116 begin
   117 BotLevel:= Me^.Hedgehog^.BotLevel;
   117 BotLevel:= Me^.Hedgehog^.BotLevel;
   118 windSpeed:= hwFloat2Float(cWindSpeed);
   118 windSpeed:= hwFloat2Float(cWindSpeed);
   119 
   119 
   185                         AddAction(BestActions, aia_attack, aim_push, 1, 0, 0);
   185                         AddAction(BestActions, aia_attack, aim_push, 1, 0, 0);
   186                         AddAction(BestActions, aia_attack, aim_release, 1, 0, 0);
   186                         AddAction(BestActions, aia_attack, aim_release, 1, 0, 0);
   187                         end else
   187                         end else
   188                         if (Ammoz[a].Ammo.Propz and ammoprop_AttackingPut) = 0 then
   188                         if (Ammoz[a].Ammo.Propz and ammoprop_AttackingPut) = 0 then
   189                             begin
   189                             begin
       
   190                             if (AmmoTests[a].flags and amtest_MultipleAttacks) = 0 then
       
   191                                 n:= 1 else n:= ap.AttacksNum;
       
   192 
   190                             AddAction(BestActions, aia_attack, aim_push, 650 + random(300), 0, 0);
   193                             AddAction(BestActions, aia_attack, aim_push, 650 + random(300), 0, 0);
       
   194                             for t:= 2 to n do
       
   195                                 begin
       
   196                                 AddAction(BestActions, aia_attack, aim_push, 150, 0, 0);
       
   197                                 AddAction(BestActions, aia_attack, aim_release, ap.Power, 0, 0);
       
   198                                 end;
   191                             AddAction(BestActions, aia_attack, aim_release, ap.Power, 0, 0);
   199                             AddAction(BestActions, aia_attack, aim_release, ap.Power, 0, 0);
   192                             end;
   200                             end;
   193 
   201 
   194                     if (Ammoz[a].Ammo.Propz and ammoprop_Track) <> 0 then
   202                     if (Ammoz[a].Ammo.Propz and ammoprop_Track) <> 0 then
   195                         begin
   203                         begin
   502     end;
   510     end;
   503 
   511 
   504 FillBonuses(((Me^.State and gstAttacked) <> 0) and (not isInMultiShoot));
   512 FillBonuses(((Me^.State and gstAttacked) <> 0) and (not isInMultiShoot));
   505 
   513 
   506 SDL_LockMutex(ThreadLock);
   514 SDL_LockMutex(ThreadLock);
   507 ThinkThread:= SDL_CreateThread(@Think{$IFDEF SDL13}, 'think'{$ENDIF}, Me);
   515 ThinkThread:= SDL_CreateThread(@Think{$IFDEF SDL2}, 'think'{$ENDIF}, Me);
   508 SDL_UnlockMutex(ThreadLock);
   516 SDL_UnlockMutex(ThreadLock);
   509 end;
   517 end;
   510 
   518 
   511 {$IFDEF DEBUGAI}
   519 {$IFDEF DEBUGAI}
   512 var scoreShown: boolean = false;
   520 var scoreShown: boolean = false;