hedgewars/uAI.pas
changeset 370 c75410fe3133
parent 369 2aed85310727
child 371 731ad6d27bd1
equal deleted inserted replaced
369:2aed85310727 370:c75410fe3133
    44     Angle, Power, Score, ExplX, ExplY, ExplR: integer;
    44     Angle, Power, Score, ExplX, ExplY, ExplR: integer;
    45     i: integer;
    45     i: integer;
    46     a, aa: TAmmoType;
    46     a, aa: TAmmoType;
    47 begin
    47 begin
    48 BotLevel:= PHedgehog(Me^.Hedgehog)^.BotLevel;
    48 BotLevel:= PHedgehog(Me^.Hedgehog)^.BotLevel;
    49 
       
    50 for i:= 0 to Pred(Targets.Count) do
    49 for i:= 0 to Pred(Targets.Count) do
    51     if (Targets.ar[i].Score >= 0) then
    50     if (Targets.ar[i].Score >= 0) then
    52        begin
    51        begin
    53        with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
    52        with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
    54             a:= Ammo^[CurSlot, CurAmmo].AmmoType;
    53             a:= Ammo^[CurSlot, CurAmmo].AmmoType;
   115        exit
   114        exit
   116        end;
   115        end;
   117 
   116 
   118     AddAction(Actions, Me^.Message, aim_push, 10, 0, 0);
   117     AddAction(Actions, Me^.Message, aim_push, 10, 0, 0);
   119     if (Me^.Message and gm_Left) <> 0 then AddAction(Actions, aia_WaitXL, hwRound(Me^.X), 0, 0, 0)
   118     if (Me^.Message and gm_Left) <> 0 then AddAction(Actions, aia_WaitXL, hwRound(Me^.X), 0, 0, 0)
   120                                      else AddAction(Actions, aia_WaitXR, hwRound(Me^.X), 0, 0, 0);
   119                                       else AddAction(Actions, aia_WaitXR, hwRound(Me^.X), 0, 0, 0);
   121     AddAction(Actions, Me^.Message, aim_release, 0, 0, 0);
   120     AddAction(Actions, Me^.Message, aim_release, 0, 0, 0);
   122     steps:= 0;
   121     steps:= 0;
   123     if ((Me^.State and gstAttacked) = 0) then TestAmmos(Actions, Me);
   122     if ((Me^.State and gstAttacked) = 0) then TestAmmos(Actions, Me);
   124 
   123 
   125     while not PosInThinkStack(Me) do
   124     while not PosInThinkStack(Me) do
   143                   begin
   142                   begin
   144                   AddAction(MadeActions, aia_LJump, 0, 305, 0, 0);
   143                   AddAction(MadeActions, aia_LJump, 0, 305, 0, 0);
   145                   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)
   146                                  else AddAction(MadeActions, aia_WaitXR, hwRound(AltMe.X), 0, 0, 0);
   145                                  else AddAction(MadeActions, aia_WaitXR, hwRound(AltMe.X), 0, 0, 0);
   147                   end;
   146                   end;
   148 
       
   149        if not CanGo then break;
   147        if not CanGo then break;
   150        inc(steps);
   148        inc(steps);
   151        Actions.actions[Actions.Count - 2].Param:= hwRound(Me^.X);
   149        Actions.actions[Actions.Count - 2].Param:= hwRound(Me^.X);
   152        Rate:= RatePlace(Me);
   150        Rate:= RatePlace(Me);
   153        if Rate > BaseRate then
   151        if Rate > BaseRate then