In AI survival mode, have the AI score when it kills humans, instead of its own team, clear poison on an AI kill, and reset AI health using InitialHealth instead of 100.
authornemo
Sat, 04 Dec 2010 11:30:54 -0500
changeset 4455 a0c8779713f2
parent 4454 42bfc1a70968
child 4456 b69f43f07cd7
child 4457 ffb766e85150
In AI survival mode, have the AI score when it kills humans, instead of its own team, clear poison on an AI kill, and reset AI health using InitialHealth instead of 100.
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Sat Dec 04 08:52:57 2010 +0100
+++ b/hedgewars/uGears.pas	Sat Dec 04 11:30:54 2010 -0500
@@ -535,7 +535,14 @@
                     end
             end;
         inc(KilledHHs);
-        RecountTeamHealth(team)
+        RecountTeamHealth(team);
+        if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and not Gear^.Hedgehog^.Effects[heResurrectable] then
+            with CurrentHedgehog^ do 
+                begin
+                inc(Team^.stats.AIKills);
+                if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex);
+                Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
+                end
         end;
 {$IFDEF DEBUGFILE}
 with Gear^ do AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
@@ -1451,12 +1458,15 @@
     gear^.State := gstWait;
     uStats.HedgehogDamaged(gear);
     gear^.Damage := 0;
-    gear^.Health := 100;
-    with CurrentHedgehog^ do begin
-        inc(Team^.stats.AIKills);
-        if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex);
-        Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
-    end;
+    gear^.Health := gear^.Hedgehog^.InitialHealth;
+    gear^.Hedgehog^.Effects[hePoisoned] := false;
+    if not CurrentHedgehog^.Effects[heResurrectable] then
+        with CurrentHedgehog^ do 
+            begin
+            inc(Team^.stats.AIKills);
+            if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex);
+            Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
+            end;
     tempTeam := gear^.Hedgehog^.Team;
     DeleteCI(gear);
     FindPlace(gear, false, 0, LAND_WIDTH, true);