small tweak. make drowning prefer higher health hogs
authornemo
Sun, 11 Mar 2012 22:35:55 -0400
changeset 6772 13d13aefa4de
parent 6771 87a947097d00
child 6773 46cd5dad1a28
small tweak. make drowning prefer higher health hogs
hedgewars/uAIAmmoTests.pas
hedgewars/uAIMisc.pas
--- a/hedgewars/uAIAmmoTests.pas	Sun Mar 11 20:36:50 2012 -0400
+++ b/hedgewars/uAIAmmoTests.pas	Sun Mar 11 22:35:55 2012 -0400
@@ -174,7 +174,8 @@
         valueResult:= value
         end;
     end
-until (value > 204800) or (rTime > 4250);
+//until (value > 204800) or (rTime > 4250); not so useful since adding score to the drowning
+until rTime > 4250;
 TestBazooka:= valueResult
 end;
 
@@ -328,7 +329,8 @@
         valueResult:= Score
         end;
     end
-until (Score > 204800) or (TestTime > 4000);
+//until (Score > 204800) or (TestTime > 4000);
+until TestTime > 4000;
 TestGrenade:= valueResult
 end;
 
--- a/hedgewars/uAIMisc.pas	Sun Mar 11 20:36:50 2012 -0400
+++ b/hedgewars/uAIMisc.pas	Sun Mar 11 22:35:55 2012 -0400
@@ -319,9 +319,9 @@
                 end;
             if (Flags and 1 <> 0) and TraceDrown(x, y, Point.x, Point.y, dX, dY, erasure) then
                 if Score > 0 then
-                    inc(rate, KillScore)
+                    inc(rate, KillScore + Score)   // Add a bit of a bonus for bigger hog drownings
                 else
-                    dec(rate, KillScore * friendlyfactor div 100)
+                    dec(rate, KillScore * friendlyfactor div 100 - Score) // and more of a punishment for drowning bigger friendly hogs
             else if dmg >= abs(Score) then
                 if Score > 0 then
                     inc(rate, KillScore)
@@ -361,9 +361,9 @@
                 end;
             if (Flags and 1 <> 0) and TraceShoveDrown(Me, Point.x, Point.y, dX, dY) then
                 if Score > 0 then
-                    inc(rate, KillScore)
+                    inc(rate, KillScore + Score)   // Add a bit of a bonus for bigger hog drownings
                 else
-                    dec(rate, KillScore * friendlyfactor div 100)
+                    dec(rate, KillScore * friendlyfactor div 100 - Score) // 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 +412,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)
+                    inc(rate, KillScore + Score)   // Add a bit of a bonus for bigger hog drownings
                 else
-                    dec(rate, KillScore * friendlyfactor div 100)
+                    dec(rate, KillScore * friendlyfactor div 100 - Score) // and more of a punishment for drowning bigger friendly hogs
             else if dmg >= abs(Score) then
                 dmg := KillScore;
             if Score > 0 then