hedgewars/uAIMisc.pas
changeset 1941 b1ef1f86148c
parent 1799 b945f4174d00
child 2376 ece7b87f1334
--- a/hedgewars/uAIMisc.pas	Fri Apr 03 16:35:59 2009 +0000
+++ b/hedgewars/uAIMisc.pas	Fri Apr 03 16:38:16 2009 +0000
@@ -237,6 +237,8 @@
 end;
 
 function RateShotgun(Me: PGear; x, y: LongInt): LongInt;
+const
+  REUSE_BONUS = 1.35;
 var i, dmg, Result: LongInt;
 begin
 Result:= 0;
@@ -252,14 +254,12 @@
     with Targets.ar[i] do
          begin
          dmg:= min(cHHRadius + cShotgunRadius - hwRound(DistanceI(Point.x - x, Point.y - y)), 25);
+         dmg := round(dmg * REUSE_BONUS);
          if dmg > 0 then
             begin
-            if dmg >= abs(Score) then
-               if Score > 0 then inc(Result, KillScore)
-                            else dec(Result, KillScore * friendlyfactor div 100)
-            else
-               if Score > 0 then inc(Result, dmg)
-                            else dec(Result, dmg * friendlyfactor div 100)
+                if dmg >= abs(Score) then dmg := KillScore;
+                if Score > 0 then inc(Result, dmg)
+                else dec(Result, dmg * friendlyfactor div 100);
             end;
          end;
 RateShotgun:= Result * 1024