Try adding it to deagle too. Although the routine still doesn't consider angle, so it'll pretty much be luck. Might be a waste of time.
authornemo
Sun, 11 Mar 2012 23:24:09 -0400
changeset 6774 237b96f06aae
parent 6773 46cd5dad1a28
child 6775 22b5fb7217db
Try adding it to deagle too. Although the routine still doesn't consider angle, so it'll pretty much be luck. Might be a waste of time. Also fix some neglected scores from before.
hedgewars/uAIAmmoTests.pas
hedgewars/uAIMisc.pas
--- a/hedgewars/uAIAmmoTests.pas	Sun Mar 11 22:44:57 2012 -0400
+++ b/hedgewars/uAIAmmoTests.pas	Sun Mar 11 23:24:09 2012 -0400
@@ -576,7 +576,7 @@
 ap.Power:= 1;
 x:= Me^.X;
 y:= Me^.Y;
-if Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) < 80 then
+if Abs(hwRound(Me^.X) - Targ.X) + Abs(hwRound(Me^.Y) - Targ.Y) < 320 then
    exit(BadTurn);
 t:= _0_5 / Distance(int2hwFloat(Targ.X) - x, int2hwFloat(Targ.Y) - y);
 Vx:= (int2hwFloat(Targ.X) - x) * t;
@@ -598,7 +598,11 @@
     or (d > 200);
 
 if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then
-    valueResult:= Max(0, (4 - d div 50) * 7 * 1024)
+    begin
+    if TraceShoveDrown(Me, Targ.X, Targ.Y, hwFloat2Float(vX) * 0.005 * 20, hwFloat2Float(vY) * 0.005 * 20) then
+        valueResult:= 204800
+    else valueResult:= Max(0, (4 - d div 50) * 7 * 1024)
+    end
 else
     valueResult:= BadTurn;
 TestDesertEagle:= valueResult
--- a/hedgewars/uAIMisc.pas	Sun Mar 11 22:44:57 2012 -0400
+++ b/hedgewars/uAIMisc.pas	Sun Mar 11 23:24:09 2012 -0400
@@ -53,6 +53,7 @@
 function RatePlace(Gear: PGear): LongInt;
 function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline;
 function TestColl(x, y, r: LongInt): boolean; inline;
+function TraceShoveDrown(Me: PGear; x, y, dX, dY: Real): boolean;
 function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord = 0): LongInt;
 function RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
 function RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
@@ -361,9 +362,9 @@
                 end;
             if (Flags and 1 <> 0) and TraceShoveDrown(Me, Point.x, Point.y, dX, dY) then
                 if Score > 0 then
-                    inc(rate, KillScore + Score)   // Add a bit of a bonus for bigger hog drownings
+                    inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings
                 else
-                    dec(rate, KillScore * friendlyfactor div 100 - Score) // and more of a punishment for drowning bigger friendly hogs
+                    dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs
             else if power >= abs(Score) then
                 if Score > 0 then
                     inc(rate, KillScore)
@@ -412,9 +413,9 @@
             else dX:= dX + 0.01;
             if TraceDrown(x, y, Point.x, Point.y, dX, dY, erasure) then
                 if Score > 0 then
-                    inc(rate, KillScore + Score)   // Add a bit of a bonus for bigger hog drownings
+                    inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings
                 else
-                    dec(rate, KillScore * friendlyfactor div 100 - Score) // and more of a punishment for drowning bigger friendly hogs
+                    dec(rate, KillScore * friendlyfactor div 100 - Score div 10) // and more of a punishment for drowning bigger friendly hogs
             else if dmg >= abs(Score) then
                 dmg := KillScore;
             if Score > 0 then