hedgewars/uAI.pas
changeset 375 18012da67681
parent 371 731ad6d27bd1
child 393 db01cc79f278
equal deleted inserted replaced
374:95169697cc38 375:18012da67681
   132              with ThinkStack.States[Pred(ThinkStack.Count)] do
   132              with ThinkStack.States[Pred(ThinkStack.Count)] do
   133                   begin
   133                   begin
   134                   AddAction(MadeActions, aia_HJump, 0, 305, 0, 0);
   134                   AddAction(MadeActions, aia_HJump, 0, 305, 0, 0);
   135                   AddAction(MadeActions, aia_HJump, 0, 350, 0, 0);
   135                   AddAction(MadeActions, aia_HJump, 0, 350, 0, 0);
   136                   if (Me^.dX < 0) then AddAction(MadeActions, aia_WaitXL, hwRound(AltMe.X), 0, 0, 0)
   136                   if (Me^.dX < 0) then AddAction(MadeActions, aia_WaitXL, hwRound(AltMe.X), 0, 0, 0)
   137                                  else AddAction(MadeActions, aia_WaitXR, hwRound(AltMe.X), 0, 0, 0);
   137                                   else AddAction(MadeActions, aia_WaitXR, hwRound(AltMe.X), 0, 0, 0);
   138                   end;
   138                   end;
   139        if (BotLevel < 3) and (GoInfo.JumpType = jmpLJump) then // ljump support
   139        if (BotLevel < 3) and (GoInfo.JumpType = jmpLJump) then // ljump support
   140           if Push(ticks, Actions, AltMe, Me^.Message) then
   140           if Push(ticks, Actions, AltMe, Me^.Message) then
   141              with ThinkStack.States[Pred(ThinkStack.Count)] do
   141              with ThinkStack.States[Pred(ThinkStack.Count)] do
   142                   begin
   142                   begin
   143                   AddAction(MadeActions, aia_LJump, 0, 305, 0, 0);
   143                   AddAction(MadeActions, aia_LJump, 0, 305, 0, 0);
   144                   if (Me^.dX < 0) then AddAction(MadeActions, aia_WaitXL, hwRound(AltMe.X), 0, 0, 0)
   144                   if (Me^.dX < 0) then AddAction(MadeActions, aia_WaitXL, hwRound(AltMe.X), 0, 0, 0)
   145                                  else AddAction(MadeActions, aia_WaitXR, hwRound(AltMe.X), 0, 0, 0);
   145                                   else AddAction(MadeActions, aia_WaitXR, hwRound(AltMe.X), 0, 0, 0);
   146                   end;
   146                   end;
   147        if not CanGo then break;
   147        if not CanGo then break;
   148        inc(steps);
   148        inc(steps);
   149        Actions.actions[Actions.Count - 2].Param:= hwRound(Me^.X);
   149        Actions.actions[Actions.Count - 2].Param:= hwRound(Me^.X);
   150        Rate:= RatePlace(Me);
   150        Rate:= RatePlace(Me);
   160           Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right
   160           Push(ticks, Actions, Me^, Me^.Message xor 3); // aia_Left xor 3 = aia_Right
   161 
   161 
   162        if ((Me^.State and gstAttacked) = 0)
   162        if ((Me^.State and gstAttacked) = 0)
   163            and ((steps mod 4) = 0) then
   163            and ((steps mod 4) = 0) then
   164            begin
   164            begin
   165            if SDL_GetTicks - AIThinkStart > 3 then
   165            TestAmmos(Actions, Me);
       
   166            if SDL_GetTicks - AIThinkStart >= cTimerInterval then
   166               begin
   167               begin
   167               dec(Actions.Count, 3);
   168               dec(Actions.Count, 3);
   168               Push(ticks, Actions, Me^, Me^.Message);
   169               Push(ticks, Actions, Me^, Me^.Message);
   169               exit
   170               exit
   170               end;
   171               end
   171            TestAmmos(Actions, Me)
       
   172            end
   172            end
   173        end;
   173        end;
   174 until false
   174 until false
   175 end;
   175 end;
   176 
   176