hedgewars/uAI.pas
changeset 10510 9329dab04490
parent 10231 b2a68e75e55c
child 11046 47a8c19ecb60
equal deleted inserted replaced
10509:d62d3c706947 10510:9329dab04490
   131             Score:= AmmoTests[a].proc(Me, Targets.ar[i], BotLevel, ap);
   131             Score:= AmmoTests[a].proc(Me, Targets.ar[i], BotLevel, ap);
   132 {$HINTS ON}
   132 {$HINTS ON}
   133             if (Score > BadTurn) and (Actions.Score + Score > BestActions.Score) then
   133             if (Score > BadTurn) and (Actions.Score + Score > BestActions.Score) then
   134                 if (BestActions.Score < 0) or (Actions.Score + Score > BestActions.Score + Byte(BotLevel - 1) * 2048) then
   134                 if (BestActions.Score < 0) or (Actions.Score + Score > BestActions.Score + Byte(BotLevel - 1) * 2048) then
   135                     begin
   135                     begin
   136                     if useThisActions then 
   136                     if useThisActions then
   137                         begin
   137                         begin
   138                         BestActions.Count:= Actions.Count
   138                         BestActions.Count:= Actions.Count
   139                         end
   139                         end
   140                     else
   140                     else
   141                         begin
   141                         begin
   159                         if HHHasAmmo(Me^.Hedgehog^, amExtraDamage) > 0 then
   159                         if HHHasAmmo(Me^.Hedgehog^, amExtraDamage) > 0 then
   160                             begin
   160                             begin
   161                             AddAction(BestActions, aia_Weapon, Longword(amExtraDamage), 80, 0, 0);
   161                             AddAction(BestActions, aia_Weapon, Longword(amExtraDamage), 80, 0, 0);
   162                             AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
   162                             AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
   163                             AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
   163                             AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
   164                             end; 
   164                             end;
   165                         end;
   165                         end;
   166     
   166 
   167                     AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0);
   167                     AddAction(BestActions, aia_Weapon, Longword(a), 300 + random(400), 0, 0);
   168 
   168 
   169                     if (ap.Angle > 0) then
   169                     if (ap.Angle > 0) then
   170                         AddAction(BestActions, aia_LookRight, 0, 200, 0, 0)
   170                         AddAction(BestActions, aia_LookRight, 0, 200, 0, 0)
   171                     else if (ap.Angle < 0) then
   171                     else if (ap.Angle < 0) then
   461         if (BestActions.Score < -1023) and (not BestActions.isWalkingToABetterPlace) then
   461         if (BestActions.Score < -1023) and (not BestActions.isWalkingToABetterPlace) then
   462             begin
   462             begin
   463             BestActions.Count:= 0;
   463             BestActions.Count:= 0;
   464 
   464 
   465             FillBonuses(false);
   465             FillBonuses(false);
   466             
   466 
   467             if not bonuses.activity then
   467             if not bonuses.activity then
   468                 AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   468                 AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   469             end;
   469             end;
   470 
   470 
   471         end else SDL_Delay(100)
   471         end else SDL_Delay(100)