hedgewars/uAIMisc.pas
changeset 1941 b1ef1f86148c
parent 1799 b945f4174d00
child 2376 ece7b87f1334
equal deleted inserted replaced
1940:bbdca883b5f9 1941:b1ef1f86148c
   235          end;
   235          end;
   236 RateShove:= Result * 1024
   236 RateShove:= Result * 1024
   237 end;
   237 end;
   238 
   238 
   239 function RateShotgun(Me: PGear; x, y: LongInt): LongInt;
   239 function RateShotgun(Me: PGear; x, y: LongInt): LongInt;
       
   240 const
       
   241   REUSE_BONUS = 1.35;
   240 var i, dmg, Result: LongInt;
   242 var i, dmg, Result: LongInt;
   241 begin
   243 begin
   242 Result:= 0;
   244 Result:= 0;
   243 // add our virtual position
   245 // add our virtual position
   244 with Targets.ar[Targets.Count] do
   246 with Targets.ar[Targets.Count] do
   250 // rate shot
   252 // rate shot
   251 for i:= 0 to Targets.Count do
   253 for i:= 0 to Targets.Count do
   252     with Targets.ar[i] do
   254     with Targets.ar[i] do
   253          begin
   255          begin
   254          dmg:= min(cHHRadius + cShotgunRadius - hwRound(DistanceI(Point.x - x, Point.y - y)), 25);
   256          dmg:= min(cHHRadius + cShotgunRadius - hwRound(DistanceI(Point.x - x, Point.y - y)), 25);
       
   257          dmg := round(dmg * REUSE_BONUS);
   255          if dmg > 0 then
   258          if dmg > 0 then
   256             begin
   259             begin
   257             if dmg >= abs(Score) then
   260                 if dmg >= abs(Score) then dmg := KillScore;
   258                if Score > 0 then inc(Result, KillScore)
   261                 if Score > 0 then inc(Result, dmg)
   259                             else dec(Result, KillScore * friendlyfactor div 100)
   262                 else dec(Result, dmg * friendlyfactor div 100);
   260             else
       
   261                if Score > 0 then inc(Result, dmg)
       
   262                             else dec(Result, dmg * friendlyfactor div 100)
       
   263             end;
   263             end;
   264          end;
   264          end;
   265 RateShotgun:= Result * 1024
   265 RateShotgun:= Result * 1024
   266 end;
   266 end;
   267 
   267