hedgewars/uAI.pas
changeset 7178 c61cfc9eb29d
parent 7164 fad64b97947e
child 7197 5a9775b97c7e
equal deleted inserted replaced
7176:fb4b0c6dfdbd 7178:c61cfc9eb29d
   127         SDL_delay(0);    //ThreadSwitch was only a hint
   127         SDL_delay(0);    //ThreadSwitch was only a hint
   128 {$ELSE}
   128 {$ELSE}
   129         ThreadSwitch();
   129         ThreadSwitch();
   130 {$ENDIF}       
   130 {$ENDIF}       
   131         repeat
   131         repeat
   132         if (CanUseAmmo[a]) and
   132         if (CanUseAmmo[a]) 
   133             ((not isMoved) or ((AmmoTests[a].flags and amtest_OnTurn) = 0)) then
   133             and ((not isMoved) or ((AmmoTests[a].flags and amtest_OnTurn) = 0)) 
       
   134             and ((i = 0) or ((AmmoTests[a].flags and amtest_NoTarget) = 0)) 
       
   135             then
   134             begin
   136             begin
   135 {$HINTS OFF}
   137 {$HINTS OFF}
   136             Score:= AmmoTests[a].proc(Me, Targets.ar[i].Point, BotLevel, ap);
   138             Score:= AmmoTests[a].proc(Me, Targets.ar[i].Point, BotLevel, ap);
   137 {$HINTS ON}
   139 {$HINTS ON}
   138             if Actions.Score + Score > BestActions.Score then
   140             if Actions.Score + Score > BestActions.Score then
   179                     end
   181                     end
   180             end;
   182             end;
   181         if a = High(TAmmoType) then
   183         if a = High(TAmmoType) then
   182             a:= Low(TAmmoType)
   184             a:= Low(TAmmoType)
   183         else inc(a)
   185         else inc(a)
   184         until (a = aa) or (CurrentHedgehog^.MultiShootAttacks > 0) or // shooting same weapon
   186         until (a = aa) or (CurrentHedgehog^.MultiShootAttacks > 0) {shooting same weapon}
   185         StopThinking
   187             or StopThinking
   186         end
   188         end
   187 end;
   189 end;
   188 
   190 
   189 procedure Walk(Me: PGear; var Actions: TActions);
   191 procedure Walk(Me: PGear; var Actions: TActions);
   190 const FallPixForBranching = cHHRadius * 2 + 8;
   192 const FallPixForBranching = cHHRadius * 2 + 8;