hedgewars/uAI.pas
changeset 15658 34c32a11203e
parent 15654 25132742a948
child 15659 fd1a580a35d6
equal deleted inserted replaced
15657:e229d0cacd37 15658:34c32a11203e
   104     a, aa: TAmmoType;
   104     a, aa: TAmmoType;
   105     useThisActions: boolean;
   105     useThisActions: boolean;
   106 begin
   106 begin
   107 BotLevel:= Me^.Hedgehog^.BotLevel;
   107 BotLevel:= Me^.Hedgehog^.BotLevel;
   108 windSpeed:= hwFloat2Float(cWindSpeed);
   108 windSpeed:= hwFloat2Float(cWindSpeed);
       
   109 aiLaserSighting:= (cLaserSighting) or (HHHasAmmo(Me^.Hedgehog^, amLaserSight) > 0);
   109 useThisActions:= false;
   110 useThisActions:= false;
   110 Me^.AIHints:= Me^.AIHints and (not aihAmmosChanged);
   111 Me^.AIHints:= Me^.AIHints and (not aihAmmosChanged);
   111 
   112 
   112 for i:= 0 to Pred(Targets.Count) do
   113 for i:= 0 to Pred(Targets.Count) do
   113     if (Targets.ar[i].Score >= 0) and (not StopThinking) then
   114     if (Targets.ar[i].Score >= 0) and (not StopThinking) then
   139                         useThisActions:= true
   140                         useThisActions:= true
   140                         end;
   141                         end;
   141 
   142 
   142                     BestActions.Score:= Actions.Score + Score;
   143                     BestActions.Score:= Actions.Score + Score;
   143 
   144 
   144                     // if not between shots, activate invulnerability/vampirism if available
   145                     // if not between shots, activate invulnerability/vampirism/etc. if available
   145                     if CurrentHedgehog^.MultiShootAttacks = 0 then
   146                     if CurrentHedgehog^.MultiShootAttacks = 0 then
   146                         begin
   147                         begin
       
   148                         if (not cLaserSighting) and (HHHasAmmo(Me^.Hedgehog^, amLaserSight) > 0) and ((AmmoTests[a].flags and amtest_LaserSight) <> 0) then
       
   149                             begin
       
   150                             AddAction(BestActions, aia_Weapon, Longword(amLaserSight), 80, 0, 0);
       
   151                             AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
       
   152                             AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
       
   153                             end;
   147                         if (HHHasAmmo(Me^.Hedgehog^, amInvulnerable) > 0) and (Me^.Hedgehog^.Effects[heInvulnerable] = 0) then
   154                         if (HHHasAmmo(Me^.Hedgehog^, amInvulnerable) > 0) and (Me^.Hedgehog^.Effects[heInvulnerable] = 0) then
   148                             begin
   155                             begin
   149                             AddAction(BestActions, aia_Weapon, Longword(amInvulnerable), 80, 0, 0);
   156                             AddAction(BestActions, aia_Weapon, Longword(amInvulnerable), 80, 0, 0);
   150                             AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
   157                             AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
   151                             AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
   158                             AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
   152                             end;
   159                             end;
   153 
       
   154                         if (HHHasAmmo(Me^.Hedgehog^, amExtraDamage) > 0) and (cDamageModifier <> _1_5) then
   160                         if (HHHasAmmo(Me^.Hedgehog^, amExtraDamage) > 0) and (cDamageModifier <> _1_5) then
   155                             begin
   161                             begin
   156                             AddAction(BestActions, aia_Weapon, Longword(amExtraDamage), 80, 0, 0);
   162                             AddAction(BestActions, aia_Weapon, Longword(amExtraDamage), 80, 0, 0);
   157                             AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
   163                             AddAction(BestActions, aia_attack, aim_push, 10, 0, 0);
   158                             AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);
   164                             AddAction(BestActions, aia_attack, aim_release, 10, 0, 0);