equal
deleted
inserted
replaced
102 function TeamSize(p: PTeam): Longword; |
102 function TeamSize(p: PTeam): Longword; |
103 procedure RecountTeamHealth(team: PTeam); |
103 procedure RecountTeamHealth(team: PTeam); |
104 procedure RestoreTeamsFromSave; |
104 procedure RestoreTeamsFromSave; |
105 function CheckForWin: boolean; |
105 function CheckForWin: boolean; |
106 procedure TeamGone(s: shortstring); |
106 procedure TeamGone(s: shortstring); |
|
107 procedure TeamGoneEffect(var Team: TTeam); |
107 |
108 |
108 implementation |
109 implementation |
109 uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uChat, uVisualGears; |
110 uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uChat, uVisualGears; |
110 const MaxTeamHealth: LongInt = 0; |
111 const MaxTeamHealth: LongInt = 0; |
111 |
112 |
195 PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn |
196 PrevHH:= CurrHedgehog mod HedgehogsNumber; // prevent infinite loop when CurrHedgehog = 7, but HedgehogsNumber < 8 (team is destroyed before its first turn |
196 repeat |
197 repeat |
197 CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber; |
198 CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber; |
198 until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH) |
199 until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH) |
199 end |
200 end |
200 until ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (not CurrentTeam^.hasGone)) or (PrevTeam = CurrTeam); |
201 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam); |
201 end |
202 end |
202 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (not CurrentTeam^.hasGone); |
203 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil); |
203 |
204 |
204 CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]) |
205 CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]) |
205 end; |
206 end; |
206 |
207 |
207 procedure AfterSwitchHedgehog; |
208 procedure AfterSwitchHedgehog; |
366 for t:= 0 to Pred(TeamsCount) do |
367 for t:= 0 to Pred(TeamsCount) do |
367 TeamsArray[t]^.ExtDriven:= false |
368 TeamsArray[t]^.ExtDriven:= false |
368 end; |
369 end; |
369 |
370 |
370 procedure TeamGone(s: shortstring); |
371 procedure TeamGone(s: shortstring); |
371 var i, t: LongInt; |
372 var t: LongInt; |
372 begin |
373 begin |
373 t:= 0; |
374 t:= 0; |
374 while (t < cMaxTeams) |
375 while (t < cMaxTeams) |
375 and (TeamsArray[t] <> nil) |
376 and (TeamsArray[t] <> nil) |
376 and (TeamsArray[t]^.TeamName <> s) do inc(t); |
377 and (TeamsArray[t]^.TeamName <> s) do inc(t); |
377 if (t = cMaxTeams) or (TeamsArray[t] = nil) then exit; |
378 if (t = cMaxTeams) or (TeamsArray[t] = nil) then exit; |
378 |
379 |
379 with TeamsArray[t]^ do |
380 with TeamsArray[t]^ do |
380 begin |
381 begin |
381 AddChatString('** '+ TeamName + ' is gone'); |
382 AddChatString('** '+ TeamName + ' is gone'); |
382 for i:= 0 to cMaxHHIndex do |
|
383 with Hedgehogs[i] do |
|
384 if Gear <> nil then |
|
385 begin |
|
386 if Gear^.State and gstAttacking <> 0 then |
|
387 AttackBar:= 0; |
|
388 |
|
389 Gear^.State:= Gear^.State and not gstHHDriven |
|
390 end; |
|
391 |
|
392 hasGone:= true |
383 hasGone:= true |
393 end; |
384 end; |
394 |
385 |
395 RecountTeamHealth(TeamsArray[t]) |
386 RecountTeamHealth(TeamsArray[t]) |
396 end; |
387 end; |
397 |
388 |
|
389 procedure TeamGoneEffect(var Team: TTeam); |
|
390 var i: LongInt; |
|
391 begin |
|
392 with Team do |
|
393 for i:= 0 to cMaxHHIndex do |
|
394 with Hedgehogs[i] do |
|
395 if Gear <> nil then |
|
396 Gear^.Damage:= Gear^.Health |
|
397 end; |
|
398 |
398 initialization |
399 initialization |
399 |
400 |
400 finalization |
401 finalization |
401 |
402 |
402 FreeTeamsList |
403 FreeTeamsList |