Intended to help on bottom border maps or "red" maps - don't assume erasure if there is indestructible land below the hog
authornemo
Sun, 08 Jul 2012 10:35:40 -0400
changeset 7360 d833d1010710
parent 7357 06454899d0d2
child 7362 53bcfc714cb3
Intended to help on bottom border maps or "red" maps - don't assume erasure if there is indestructible land below the hog
hedgewars/uAIMisc.pas
--- a/hedgewars/uAIMisc.pas	Sun Jul 08 10:03:31 2012 -0400
+++ b/hedgewars/uAIMisc.pas	Sun Jul 08 10:35:40 2012 -0400
@@ -404,7 +404,10 @@
                 begin
                 dX:= 0.005 * dmg + 0.01;
                 dY:= dX;
-                fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, erasure) * dmgMod);
+                if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and 
+                   (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then
+                     fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, 0) * dmgMod)
+                else fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, erasure) * dmgMod)
                 end;
             if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI
                 if Score > 0 then
@@ -503,7 +506,10 @@
             dY:= gdY * dmg;
             if dX < 0 then dX:= dX - 0.01
             else dX:= dX + 0.01;
-            fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, erasure) * dmgMod);
+            if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and 
+               (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then
+                 fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, 0) * dmgMod)
+            else fallDmg:= trunc(TraceFall(x, y, Point.x, Point.y, dX, dY, erasure) * dmgMod);
             if fallDmg < 0 then // drowning. score healthier hogs higher, since their death is more likely to benefit the AI
                 if Score > 0 then
                     inc(rate, KillScore + Score div 10)   // Add a bit of a bonus for bigger hog drownings