hedgewars/uAI.pas
changeset 12717 31f7e0a31736
parent 12715 1ab53b945140
child 12718 927b35f59a46
equal deleted inserted replaced
12716:20dbb3a03e61 12717:31f7e0a31736
    29 procedure FreeActionsList;
    29 procedure FreeActionsList;
    30 
    30 
    31 implementation
    31 implementation
    32 uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions,
    32 uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions,
    33     uAmmos, uTypes,
    33     uAmmos, uTypes,
    34     uVariables, uCommands, uUtils, uDebug, uAILandMarks;
    34     uVariables, uCommands, uUtils, uDebug, uAILandMarks,
       
    35     uGearsUtils;
    35 
    36 
    36 var BestActions: TActions;
    37 var BestActions: TActions;
    37     CanUseAmmo: array [TAmmoType] of boolean;
    38     CanUseAmmo: array [TAmmoType] of boolean;
    38     StopThinking: boolean;
    39     StopThinking: boolean;
    39     StartTicks: Longword;
    40     StartTicks: Longword;
   471 
   472 
   472             FillBonuses(false);
   473             FillBonuses(false);
   473 
   474 
   474             // Hog has no idea what to do. Use tardis or skip
   475             // Hog has no idea what to do. Use tardis or skip
   475             if not bonuses.activity then
   476             if not bonuses.activity then
   476                 if ((HHHasAmmo(Me^.Hedgehog^, amTardis) > 0)) and (random(3) < 1) then
   477                 if ((HHHasAmmo(Me^.Hedgehog^, amTardis) > 0)) and (CanUseTardis(Me^.Hedgehog^.Gear)) and (random(3) < 1) then
   477                     // Tardis brings hog to a random place. Perfect for clueless AI
   478                     // Tardis brings hog to a random place. Perfect for clueless AI
   478                     begin
   479                     begin
   479                     AddAction(BestActions, aia_Weapon, Longword(amTardis), 80, 0, 0);
   480                     AddAction(BestActions, aia_Weapon, Longword(amTardis), 80, 0, 0);
   480                     AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
   481                     AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
   481                     AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
   482                     AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);