hedgewars/uGears.pas
changeset 307 96b428ac11f2
parent 306 7b61834edcf6
child 351 29bc9c36ad5f
--- a/hedgewars/uGears.pas	Thu Jan 04 16:27:45 2007 +0000
+++ b/hedgewars/uGears.pas	Thu Jan 04 18:54:24 2007 +0000
@@ -64,6 +64,7 @@
 
 var CurAmmoGear: PGear = nil;
     GearsList: PGear = nil;
+    KilledHHs: Longword = 0;
 
 implementation
 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions,
@@ -77,6 +78,7 @@
                                   b: boolean;
                                   end;
                  end;
+    StepDamage: Longword = 0;
 
 procedure DeleteGear(Gear: PGear); forward;
 procedure doMakeExplosion(X, Y, Radius: integer; Mask: LongWord); forward;
@@ -275,6 +277,7 @@
 
 procedure DeleteGear(Gear: PGear);
 var team: PTeam;
+    t: Longword;
 begin
 if Gear.CollIndex < High(Longword) then DeleteCI(Gear);
 if Gear.Surf <> nil then SDL_FreeSurface(Gear.Surf);
@@ -288,11 +291,16 @@
       end else
       begin
       if Gear.Y >= cWaterLine then
-         AddGear(Round(Gear.X), Round(Gear.Y), gtHealthTag, max(Gear.Damage, Gear.Health)).Hedgehog:= Gear.Hedgehog;
+         begin
+         t:= max(Gear.Damage, Gear.Health);
+         AddGear(Round(Gear.X), Round(Gear.Y), gtHealthTag, t).Hedgehog:= Gear.Hedgehog;
+         inc(StepDamage, t)
+         end;
       team:= PHedgehog(Gear.Hedgehog).Team;
       if CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear = Gear then
          FreeActionsList; // to avoid ThinkThread on drawned gear
       PHedgehog(Gear.Hedgehog).Gear:= nil;
+      inc(KilledHHs);
       RecountTeamHealth(team);
       end;
 {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF}
@@ -313,6 +321,7 @@
          if Gear.Damage <> 0 then
             begin
             Result:= false;
+            inc(StepDamage, Gear.Damage);
             if Gear.Health < Gear.Damage then Gear.Health:= 0
                                          else dec(Gear.Health, Gear.Damage);
             AddGear(Round(Gear.X), round(Gear.Y) - cHHRadius - 12 - PHedgehog(Gear.Hedgehog)^.HealthTag.h,
@@ -374,7 +383,12 @@
         stNTurn: begin
                  AwareOfExplosion(0, 0, 0);
                  if isInMultiShoot then isInMultiShoot:= false
-                                   else ParseCommand('/nextturn');
+                    else begin
+                    with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
+                         if MaxStepDamage < StepDamage then MaxStepDamage:= StepDamage;
+                    StepDamage:= 0;
+                    ParseCommand('/nextturn');
+                    end;
                  step:= Low(step)
                  end;
         end;
@@ -673,9 +687,11 @@
 procedure AmmoShove(Ammo: PGear; Damage, Power: integer);
 var t: PGearArray;
     i: integer;
+    hh: PHedgehog;
 begin
 t:= CheckGearsCollision(Ammo);
 i:= t.Count;
+hh:= Ammo.Hedgehog;
 while i > 0 do
     begin
     dec(i);
@@ -685,6 +701,7 @@
                gtMine,
                gtCase: begin
                        inc(t.ar[i].Damage, Damage);
+                       inc(hh.DamageGiven, Damage);
                        t.ar[i].dX:= Ammo.dX * Power * 0.01;
                        t.ar[i].dY:= Ammo.dY * Power * 0.01;
                        t.ar[i].Active:= true;