# HG changeset patch
# User unc0rr
# Date 1350902389 -14400
# Node ID 27f7f0190e444da9db29a99b8afb7fe97c809d57
# Parent  67c96b9c179c478f883cc59ac2e44c7e08a3d55a
Track targets better in multiattack mode

diff -r 67c96b9c179c -r 27f7f0190e44 hedgewars/uAIMisc.pas
--- 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;