Track targets better in multiattack mode
authorunc0rr
Mon, 22 Oct 2012 14:39:49 +0400
changeset 7788 27f7f0190e44
parent 7787 67c96b9c179c
child 7789 838d2e06c377
Track targets better in multiattack mode
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;