hedgewars/uAI.pas
changeset 10164 0570d4b22187
parent 10108 c68cf030eded
child 10231 b2a68e75e55c
equal deleted inserted replaced
10163:b994afa40326 10164:0570d4b22187
   413 switchImmediatelyAvailable:= (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtSwitcher);
   413 switchImmediatelyAvailable:= (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtSwitcher);
   414 if Me^.Hedgehog^.BotLevel <> 5 then
   414 if Me^.Hedgehog^.BotLevel <> 5 then
   415     switchCount:= HHHasAmmo(PGear(Me)^.Hedgehog^, amSwitch)
   415     switchCount:= HHHasAmmo(PGear(Me)^.Hedgehog^, amSwitch)
   416 else switchCount:= 0;
   416 else switchCount:= 0;
   417 
   417 
   418 if ((Me^.State and gstAttacked) = 0) or isInMultiShoot then
   418 if ((Me^.State and gstAttacked) = 0) or isInMultiShoot or bonuses.activity then
   419     if Targets.Count > 0 then
   419     if Targets.Count > 0 then
   420         begin
   420         begin
   421         // iterate over current team hedgehogs
   421         // iterate over current team hedgehogs
   422         repeat
   422         repeat
   423             WalkMe:= CurrentTeam^.Hedgehogs[itHedgehog].Gear^;
   423             WalkMe:= CurrentTeam^.Hedgehogs[itHedgehog].Gear^;
   450             or StopThinking
   450             or StopThinking
   451             or (itHedgehog = currHedgehogIndex)
   451             or (itHedgehog = currHedgehogIndex)
   452             or BestActions.isWalkingToABetterPlace;
   452             or BestActions.isWalkingToABetterPlace;
   453 
   453 
   454             if (StartTicks > GameTicks - 1500) and (not StopThinking) then
   454             if (StartTicks > GameTicks - 1500) and (not StopThinking) then
   455                 SDL_Delay(1000);
   455                 SDL_Delay(700);
   456 
   456 
   457         if (BestActions.Score < -1023) and (not BestActions.isWalkingToABetterPlace) then
   457         if (BestActions.Score < -1023) and (not BestActions.isWalkingToABetterPlace) then
   458             begin
   458             begin
   459             BestActions.Count:= 0;
   459             BestActions.Count:= 0;
   460             AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   460 
       
   461             FillBonuses(false);
       
   462             
       
   463             if not bonuses.activity then
       
   464                 AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
   461             end;
   465             end;
   462 
   466 
   463         end else SDL_Delay(100)
   467         end else SDL_Delay(100)
   464 else
   468 else
   465     begin
   469     begin
   466     BackMe:= Me^;
   470     BackMe:= Me^;
   467     i:= 12;
   471     i:= 4;
   468     while (not StopThinking) and (BestActions.Count = 0) and (i > 0) do
   472     while (not StopThinking) and (BestActions.Count = 0) and (i > 0) do
   469         begin
   473         begin
   470 
   474 
   471 (*
   475 (*
   472         // 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
   476         // 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
   478         WalkMe:= BackMe;
   482         WalkMe:= BackMe;
   479         Actions.Count:= 0;
   483         Actions.Count:= 0;
   480         Actions.Pos:= 0;
   484         Actions.Pos:= 0;
   481         Actions.Score:= 0;
   485         Actions.Score:= 0;
   482         Walk(@WalkMe, Actions);
   486         Walk(@WalkMe, Actions);
   483         dec(i);
   487         if not bonuses.activity then dec(i);
   484         if not StopThinking then
   488         if not StopThinking then
   485             SDL_Delay(100)
   489             SDL_Delay(100)
   486         end
   490         end
   487     end;
   491     end;
   488 
   492