hedgewars/uAIMisc.pas
changeset 7788 27f7f0190e44
parent 7719 eeae1cb6b6bf
child 7850 fcbb024090a4
--- a/hedgewars/uAIMisc.pas	Mon Oct 22 14:16:10 2012 +0400
+++ b/hedgewars/uAIMisc.pas	Mon Oct 22 14:39:49 2012 +0400
@@ -110,7 +110,9 @@
             begin
             for i:= 0 to cMaxHHIndex do
                 if (Hedgehogs[i].Gear <> nil)
-                and (Hedgehogs[i].Gear <> ThinkingHH) then
+                and (Hedgehogs[i].Gear <> ThinkingHH) 
+                and (Hedgehogs[i].Gear^.Health > Hedgehogs[i].Gear^.Damage) 
+                    then
                     begin
                     with Targets.ar[Targets.Count], Hedgehogs[i] do
                         begin
@@ -119,11 +121,11 @@
                         Point.Y:= hwRound(Gear^.Y);
                         if Clan <> CurrentTeam^.Clan then
                             begin
-                            Score:=  Gear^.Health;
+                            Score:= Gear^.Health - Gear^.Damage;
                             inc(e)
                             end else
                             begin
-                            Score:= -Gear^.Health;
+                            Score:= Gear^.Damage - Gear^.Health;
                             inc(f)
                             end
                         end;