hedgewars/uAIMisc.pas
changeset 8963 1a8335f0d968
parent 8962 9780e79619ed
child 8964 962ede906da1
--- a/hedgewars/uAIMisc.pas	Sun May 05 22:50:17 2013 -0400
+++ b/hedgewars/uAIMisc.pas	Tue May 07 14:59:30 2013 -0400
@@ -145,6 +145,7 @@
             dead:= false;
             Kind:= Gear^.Kind;
             Radius:= Gear^.Radius;
+            Density:= hwFloat2Float(Gear^.Density)/3;
             Flags:= Gear^.State;
             matters:= (Gear^.AIHints and aihDoesntMatter) = 0;
 
@@ -162,18 +163,11 @@
                     Score:= Gear^.Health - Gear^.Damage;
                     inc(e)
                     end;
-                Density:= 1;
                 end
             else if Gear^.Kind = gtExplosives then
-                begin
-                Score:= Gear^.Health - Gear^.Damage;
-                Density:= 2
-                end
+                Score:= Gear^.Health - Gear^.Damage
             else if Gear^.Kind = gtMine then 
-                begin
                 Score:= max(0,35-Gear^.Damage);
-                Density:= 1/3
-                end
             end;
         inc(Targets.Count)
         end;
@@ -502,10 +496,10 @@
     matters:= true;
     Kind:= gtHedgehog;
     Density:= 1;
+    Radius:= cHHRadius;
     Score:= - ThinkingHH^.Health
     end;
 // rate explosion
-dmgBase:= r + cHHRadius div 2;
 
 if (Flags and afErasesLand <> 0) and (GameFlags and gfSolidLand = 0) then erasure:= r
 else erasure:= 0;
@@ -519,6 +513,7 @@
             else
             begin
             dmg:= 0;
+            dmgBase:= r + Radius div 2;
             if abs(Point.x - x) + abs(Point.y - y) < dmgBase then
                 dmg:= trunc(dmgMod * min((dmgBase - trunc(sqrt(sqr(Point.x - x)+sqr(Point.y - y)))) div 2, r));
 
@@ -675,6 +670,7 @@
     matters:= true;
     Kind:= gtHedgehog;
     Density:= 1;
+    Radius:= cHHRadius;
     Score:= - ThinkingHH^.Health
     end;
 // rate shot