Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
authornemo
Sat, 30 Mar 2013 08:11:09 -0400
changeset 8822 fc9877ff7f1a
parent 8820 9cc4a057473f
child 8824 fe9eacd390f2
Don't reward digging close w/ drill rocket. Doesn't offer much benefit. Reduce final bonus slightly to avoid using drill like bazooka. Better would be AI doing this for all weps based on count. Make main drill loop a little more efficient.
hedgewars/GSHandlers.inc
hedgewars/uAIAmmoTests.pas
--- a/hedgewars/GSHandlers.inc	Fri Mar 29 23:58:03 2013 +0100
+++ b/hedgewars/GSHandlers.inc	Sat Mar 30 08:11:09 2013 -0400
@@ -2889,21 +2889,23 @@
     tempColl: Word;
 begin
     AllInactive := false;
-
-
-    if (Gear^.Timer > 0) and ((Gear^.Timer mod 10) = 0) then
-    begin
-        DrawTunnel(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 2, 6);
-        Gear^.X := Gear^.X + Gear^.dX;
-        Gear^.Y := Gear^.Y + Gear^.dY;
-        if (Gear^.Timer mod 30) = 0 then
-            AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust);
-        if (CheckGearDrowning(Gear)) then
-            begin
-            StopSoundChan(Gear^.SoundChannel);
-            exit
-        end
+    if (Gear^.Timer > 0) and (Gear^.Timer mod 10 <> 0) then
+        begin
+        dec(Gear^.Timer);
+        exit;
+        end;
+
+    DrawTunnel(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 2, 6);
+    Gear^.X := Gear^.X + Gear^.dX;
+    Gear^.Y := Gear^.Y + Gear^.dY;
+    if (Gear^.Timer mod 30) = 0 then
+        AddVisualGear(hwRound(Gear^.X + _20 * Gear^.dX), hwRound(Gear^.Y + _20 * Gear^.dY), vgtDust);
+    if (CheckGearDrowning(Gear)) then
+        begin
+        StopSoundChan(Gear^.SoundChannel);
+        exit
     end;
+
     tempColl:= Gear^.CollisionMask;
     Gear^.CollisionMask:= $007F;
     if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) <> 0) or TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) or (GameTicks > Gear^.FlightTime) then
--- a/hedgewars/uAIAmmoTests.pas	Fri Mar 29 23:58:03 2013 +0100
+++ b/hedgewars/uAIAmmoTests.pas	Sat Mar 30 08:11:09 2013 -0400
@@ -200,6 +200,8 @@
     t2: real;
     timer: Longint;
 begin
+    if (Level > 3) then exit(BadTurn);
+
     mX:= hwFloat2Float(Me^.X);
     mY:= hwFloat2Float(Me^.Y);
     ap.Time:= 0;
@@ -250,8 +252,6 @@
             if Level = 1 then
                 value:= RateExplosion(Me, EX, EY, 101, afTrackFall or afErasesLand)
             else value:= RateExplosion(Me, EX, EY, 101);
-            if value = 0 then
-                value:= 1024 - Metric(Targ.X, Targ.Y, EX, EY) div 64;
             if valueResult <= value then
                 begin
                 ap.Angle:= DxDy2AttackAnglef(Vx, Vy) + AIrndSign(random((Level - 1) * 9));
@@ -259,7 +259,7 @@
                 ap.ExplR:= 100;
                 ap.ExplX:= EX;
                 ap.ExplY:= EY;
-                valueResult:= value
+                valueResult:= value-5 // trying to make it slightly less attractive than a bazooka, to prevent waste.  AI could use awareness of weapon count
                 end;
             end
     until rTime > 4250;