hedgewars/uAI.pas
changeset 7164 fad64b97947e
parent 7132 baf3351646f4
child 7178 c61cfc9eb29d
equal deleted inserted replaced
7163:7db1e3a7422a 7164:fad64b97947e
   264         if (BotLevel < 3) and (GoInfo.JumpType = jmpLJump) then // ljump support
   264         if (BotLevel < 3) and (GoInfo.JumpType = jmpLJump) then // ljump support
   265             if Push(ticks, Actions, AltMe, Me^.Message) then
   265             if Push(ticks, Actions, AltMe, Me^.Message) then
   266                 with Stack.States[Pred(Stack.Count)] do
   266                 with Stack.States[Pred(Stack.Count)] do
   267                     AddAction(MadeActions, aia_LJump, 0, 305 + random(50), 0, 0);
   267                     AddAction(MadeActions, aia_LJump, 0, 305 + random(50), 0, 0);
   268 
   268 
       
   269         // 'not CanGO' means we can't go straight, possible jumps are checked above
   269         if not CanGo then
   270         if not CanGo then
   270             break;
   271             break;
   271         inc(steps);
   272         
       
   273          inc(steps);
   272          Actions.actions[Pred(Actions.Count)].Param:= hwRound(Me^.X);
   274          Actions.actions[Pred(Actions.Count)].Param:= hwRound(Me^.X);
   273          Rate:= RatePlace(Me);
   275          Rate:= RatePlace(Me);
   274          if Rate > BestRate then
   276          if Rate > BestRate then
   275             begin
   277             begin
   276             BestActions:= Actions;
   278             BestActions:= Actions;
   282             break;
   284             break;
   283         if ((Me^.State and gstAttacked) = 0) and ((steps mod 4) = 0) then
   285         if ((Me^.State and gstAttacked) = 0) and ((steps mod 4) = 0) then
   284             TestAmmos(Actions, Me, true);
   286             TestAmmos(Actions, Me, true);
   285         if GoInfo.FallPix >= FallPixForBranching then
   287         if GoInfo.FallPix >= FallPixForBranching then
   286             Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right
   288             Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right
   287         end;
   289         end {while};
   288 
   290 
   289     if BestRate > BaseRate then
   291     if BestRate > BaseRate then
   290         exit
   292         exit
   291         end
   293         end {while}
   292 end;
   294 end;
   293 
   295 
   294 function Think(Me: Pointer): ptrint;
   296 function Think(Me: Pointer): ptrint;
   295 var BackMe, WalkMe: TGear;
   297 var BackMe, WalkMe: TGear;
   296     switchCount: LongInt;
   298     switchCount: LongInt;