hedgewars/uTeams.pas
changeset 2726 a84fc5113d01
parent 2716 b9ca1bfca24f
child 2730 f56592281526
--- a/hedgewars/uTeams.pas	Sat Jan 30 18:23:42 2010 +0000
+++ b/hedgewars/uTeams.pas	Sun Jan 31 16:20:53 2010 +0000
@@ -52,6 +52,7 @@
 			HatVisibility: GLfloat;
 			stats: TStatistics;
 			Hat: String;
+            King: boolean;  // Flag for a bunch of hedgehog attributes
 			end;
 
 	TTeam = record
@@ -194,7 +195,7 @@
 			CurrentTeam:= Teams[CurrTeam];
 			with CurrentTeam^ do
 				begin
-				PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn
+				PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn)
 				repeat
 					CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
 				until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
@@ -301,6 +302,20 @@
 var i, t: LongInt;
     th: LongInt;
 begin
+
+// Some initial King buffs
+if (GameFlags and gfKing) <> 0 then
+   for i:= 0 to Pred(ClansCount) do 
+      begin
+      with ClansArray[i]^.Teams[0]^.Hedgehogs[0] do
+         begin
+         King:= true;
+         Hat:= 'crown';
+         Gear^.Health:= hwRound(int2hwFloat(Gear^.Health)*_1_5);
+         Gear^.Invulnerable:= true
+         end
+      end;
+
 for t:= 0 to Pred(TeamsCount) do
    with TeamsArray[t]^ do
       begin
@@ -312,6 +327,7 @@
              inc(th, Hedgehogs[i].Gear^.Health);
       if th > MaxTeamHealth then MaxTeamHealth:= th;
       end;
+
 RecountAllTeamsHealth
 end;