- Adjust some consts so whip and firepunch work perfectly
authorunc0rr
Sat, 09 Jun 2012 21:31:26 +0400
changeset 7210 2ff30b79d2b0
parent 7208 62e36dc45098
child 7212 ab60dbe8fd0c
- Adjust some consts so whip and firepunch work perfectly - Temporarily make AI draw expected traceshove trajectory while I'm working on baseball bat
hedgewars/uAIAmmoTests.pas
hedgewars/uAIMisc.pas
--- a/hedgewars/uAIAmmoTests.pas	Sat Jun 09 10:28:45 2012 -0400
+++ b/hedgewars/uAIAmmoTests.pas	Sat Jun 09 21:31:26 2012 +0400
@@ -726,11 +726,11 @@
     for i:= 0 to 8 do
         begin
         v1:= v1 + RateShove(Me, x - 10, y - 10 * i
-                , 15, 30, 40
+                , 18, 30, 40
                 , -0.45, -0.9, afTrackFall or afSetSkip);
         end;
     v1:= v1 + RateShove(Me, x - 10, y - 90
-            , 15, 30, 40
+            , 18, 30, 40
             , -0.45, -0.9, afTrackFall);
 
 
@@ -739,11 +739,11 @@
     for i:= 0 to 8 do
         begin
         v2:= v2 + RateShove(Me, x + 10, y - 10 * i
-                , 15, 30, 40
+                , 18, 30, 40
                 , 0.45, -0.9, afTrackFall or afSetSkip);
         end;
     v2:= v2 + RateShove(Me, x + 10, y - 90
-            , 15, 30, 40
+            , 18, 30, 40
             , 0.45, -0.9, afTrackFall);
 
     if (v2 > v1) 
@@ -781,19 +781,19 @@
     to encourage distant attacks (damaged hog is excluded from view of second 
     RateShove call)}
     v1:= RateShove(Me, x - 15, y
-            , 30, 30, 40
+            , 30, 30, 25
             , -1, -0.8, afTrackFall or afSetSkip);
     v1:= v1 +
         RateShove(Me, x, y
-            , 30, 30, 40
+            , 30, 30, 25
             , -1, -0.8, afTrackFall);
     // now try opposite direction
     v2:= RateShove(Me, x + 15, y
-            , 30, 30, 40
+            , 30, 30, 25
             , 1, -0.8, afTrackFall or afSetSkip);
     v2:= v2 +
         RateShove(Me, x, y
-            , 30, 30, 40
+            , 30, 30, 25
             , 1, -0.8, afTrackFall);
 
     if (v2 > v1) 
--- a/hedgewars/uAIMisc.pas	Sat Jun 09 10:28:45 2012 -0400
+++ b/hedgewars/uAIMisc.pas	Sat Jun 09 21:31:26 2012 +0400
@@ -81,7 +81,7 @@
         end;
 
 implementation
-uses uCollisions, uVariables, uUtils, uDebug;
+uses uCollisions, uVariables, uUtils, uDebug, uLandTexture;
 
 const KillScore = 200;
 
@@ -335,13 +335,22 @@
 end;
 
 function TraceShoveFall(x, y, dX, dY: Real): LongInt;
-var dmg: LongInt;
+var dmg, v: LongInt;
 begin
+v:= random($FFFFFFFF);
     while true do
     begin
         x:= x + dX;
         y:= y + dY;
         dY:= dY + cGravityf;
+
+        if ((trunc(y) and LAND_HEIGHT_MASK) = 0) and ((trunc(x) and LAND_WIDTH_MASK) = 0) then 
+            begin
+            LandPixels[trunc(y), trunc(x)]:= v;
+            UpdateLandTexture(trunc(X), 1, trunc(Y), 1, true);
+            end;
+
+        // consider adding dX/dY calc here for fall damage
         if TestCollExcludingObjects(trunc(x), trunc(y), cHHRadius) then
         begin
             if 0.4 < dY then
@@ -420,8 +429,8 @@
     dX, dY, dmgMod: real;
 begin
 fallDmg:= 0;
-dX:= gdX * 0.005 * kick;
-dY:= gdY * 0.005 * kick;
+dX:= gdX * 0.01 * kick;
+dY:= gdY * 0.01 * kick;
 dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent;
 rate:= 0;
 for i:= 0 to Pred(Targets.Count) do
@@ -432,10 +441,8 @@
         begin
         dmg:= 0;
         if abs(Point.x - x) + abs(Point.y - y) < r then
-            begin
             dmg:= r - trunc(sqrt(sqr(Point.x - x)+sqr(Point.y - y)));
-            dmg:= trunc(dmg * dmgMod);
-            end;
+
         if dmg > 0 then
             begin
             if (Flags and afSetSkip <> 0) then skip:= true;