18 |
18 |
19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
20 |
20 |
21 unit uStats; |
21 unit uStats; |
22 interface |
22 interface |
23 uses uGears, uConsts; |
23 uses uConsts, uTypes; |
24 |
|
25 type TStatistics = record |
|
26 DamageRecv, |
|
27 DamageGiven: Longword; |
|
28 StepDamageRecv, |
|
29 StepDamageGiven, |
|
30 StepKills: Longword; |
|
31 MaxStepDamageRecv, |
|
32 MaxStepDamageGiven, |
|
33 MaxStepKills: Longword; |
|
34 FinishedTurns: Longword; |
|
35 end; |
|
36 |
|
37 type TTeamStats = record |
|
38 Kills : Longword; |
|
39 AIKills : Longword; |
|
40 TeamKills : Longword; |
|
41 TurnSkips : Longword; |
|
42 TeamDamage : Longword; |
|
43 end; |
|
44 |
24 |
45 var TotalRounds: LongInt; |
25 var TotalRounds: LongInt; |
46 FinishedTurnsTotal: LongInt; |
26 FinishedTurnsTotal: LongInt; |
47 |
27 |
48 procedure initModule; |
28 procedure initModule; |
53 procedure Skipped; |
33 procedure Skipped; |
54 procedure TurnReaction; |
34 procedure TurnReaction; |
55 procedure SendStats; |
35 procedure SendStats; |
56 |
36 |
57 implementation |
37 implementation |
58 uses uTeams, uSound, uMisc, uLocale, uWorld; |
38 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uDebug, uMisc; |
|
39 |
59 var DamageGiven : Longword = 0; |
40 var DamageGiven : Longword = 0; |
60 DamageClan : Longword = 0; |
41 DamageClan : Longword = 0; |
61 DamageTotal : Longword = 0; |
42 DamageTotal : Longword = 0; |
62 KillsClan : LongWord = 0; |
43 KillsClan : LongWord = 0; |
63 Kills : LongWord = 0; |
44 Kills : LongWord = 0; |
69 vpHurtSameClan: PVoicepack = nil; |
50 vpHurtSameClan: PVoicepack = nil; |
70 vpHurtEnemy: PVoicepack = nil; |
51 vpHurtEnemy: PVoicepack = nil; |
71 |
52 |
72 procedure HedgehogDamaged(Gear: PGear); |
53 procedure HedgehogDamaged(Gear: PGear); |
73 begin |
54 begin |
74 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then |
55 if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then |
75 vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack |
56 vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack |
76 else |
57 else |
77 vpHurtEnemy:= PHedgehog(Gear^.Hedgehog)^.Team^.voicepack; |
58 vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack; |
78 |
59 |
79 if bBetweenTurns then exit; |
60 if bBetweenTurns then exit; |
80 |
61 |
81 ////////////////////////// |
62 ////////////////////////// |
82 |
63 |
83 if Gear <> CurrentHedgehog^.Gear then |
64 if Gear <> CurrentHedgehog^.Gear then |
84 inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage); |
65 inc(CurrentHedgehog^.stats.StepDamageGiven, Gear^.Damage); |
85 |
66 |
86 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Gear^.Damage); |
67 if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(DamageClan, Gear^.Damage); |
87 |
68 |
88 if Gear^.Health <= Gear^.Damage then |
69 if Gear^.Health <= Gear^.Damage then |
89 begin |
70 begin |
90 inc(CurrentHedgehog^.stats.StepKills); |
71 inc(CurrentHedgehog^.stats.StepKills); |
91 inc(Kills); |
72 inc(Kills); |
92 inc(KillsTotal); |
73 inc(KillsTotal); |
93 inc(CurrentHedgehog^.Team^.stats.Kills); |
74 inc(CurrentHedgehog^.Team^.stats.Kills); |
94 if (CurrentHedgehog^.Team^.TeamName = |
75 if (CurrentHedgehog^.Team^.TeamName = |
95 PHedgehog(Gear^.Hedgehog)^.Team^.TeamName) then begin |
76 Gear^.Hedgehog^.Team^.TeamName) then begin |
96 inc(CurrentHedgehog^.Team^.stats.TeamKills); |
77 inc(CurrentHedgehog^.Team^.stats.TeamKills); |
97 inc(CurrentHedgehog^.Team^.stats.TeamDamage, Gear^.Damage); |
78 inc(CurrentHedgehog^.Team^.stats.TeamDamage, Gear^.Damage); |
98 end; |
79 end; |
99 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(KillsClan); |
80 if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(KillsClan); |
100 end; |
81 end; |
101 |
82 |
102 inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Gear^.Damage); |
83 inc(Gear^.Hedgehog^.stats.StepDamageRecv, Gear^.Damage); |
103 inc(DamageGiven, Gear^.Damage); |
84 inc(DamageGiven, Gear^.Damage); |
104 inc(DamageTotal, Gear^.Damage) |
85 inc(DamageTotal, Gear^.Damage) |
105 end; |
86 end; |
106 |
87 |
107 procedure Skipped; |
88 procedure Skipped; |
235 end; |
216 end; |
236 end; |
217 end; |
237 |
218 |
238 { send player stats for winner teams } |
219 { send player stats for winner teams } |
239 if Clan^.ClanHealth > 0 then begin |
220 if Clan^.ClanHealth > 0 then begin |
240 SendStat(siPlayerKills, inttostr(Clan^.Color) + ' ' + |
221 SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' + |
241 inttostr(stats.Kills) + ' ' + TeamName); |
222 IntToStr(stats.Kills) + ' ' + TeamName); |
242 end; |
223 end; |
243 |
224 |
244 { determine maximum values of TeamKills, TurnSkips, TeamDamage } |
225 { determine maximum values of TeamKills, TurnSkips, TeamDamage } |
245 if stats.TeamKills > maxTeamKills then begin |
226 if stats.TeamKills > maxTeamKills then begin |
246 maxTeamKills := stats.TeamKills; |
227 maxTeamKills := stats.TeamKills; |
259 |
240 |
260 { now send player stats for loser teams } |
241 { now send player stats for loser teams } |
261 for t:= 0 to Pred(TeamsCount) do begin |
242 for t:= 0 to Pred(TeamsCount) do begin |
262 with TeamsArray[t]^ do begin |
243 with TeamsArray[t]^ do begin |
263 if Clan^.ClanHealth = 0 then begin |
244 if Clan^.ClanHealth = 0 then begin |
264 SendStat(siPlayerKills, inttostr(Clan^.Color) + ' ' + |
245 SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' + |
265 inttostr(stats.Kills) + ' ' + TeamName); |
246 IntToStr(stats.Kills) + ' ' + TeamName); |
266 end; |
247 end; |
267 end; |
248 end; |
268 end; |
249 end; |
269 |
250 |
270 if msdhh <> nil then |
251 if msdhh <> nil then |
271 SendStat(siMaxStepDamage, inttostr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')'); |
252 SendStat(siMaxStepDamage, IntToStr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')'); |
272 if mskcnt = 1 then |
253 if mskcnt = 1 then |
273 SendStat(siMaxStepKills, inttostr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')'); |
254 SendStat(siMaxStepKills, IntToStr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')'); |
274 |
255 |
275 if maxTeamKills > 1 then |
256 if maxTeamKills > 1 then |
276 SendStat(siMaxTeamKills, inttostr(maxTeamKills) + ' ' + maxTeamKillsName); |
257 SendStat(siMaxTeamKills, IntToStr(maxTeamKills) + ' ' + maxTeamKillsName); |
277 if maxTurnSkips > 2 then |
258 if maxTurnSkips > 2 then |
278 SendStat(siMaxTurnSkips, inttostr(maxTurnSkips) + ' ' + maxTurnSkipsName); |
259 SendStat(siMaxTurnSkips, IntToStr(maxTurnSkips) + ' ' + maxTurnSkipsName); |
279 if maxTeamDamage > 30 then |
260 if maxTeamDamage > 30 then |
280 SendStat(siMaxTeamDamage, inttostr(maxTeamDamage) + ' ' + maxTeamDamageName); |
261 SendStat(siMaxTeamDamage, IntToStr(maxTeamDamage) + ' ' + maxTeamDamageName); |
281 |
262 |
282 if KilledHHs > 0 then SendStat(siKilledHHs, inttostr(KilledHHs)); |
263 if KilledHHs > 0 then SendStat(siKilledHHs, IntToStr(KilledHHs)); |
283 end; |
264 end; |
284 |
265 |
285 procedure initModule; |
266 procedure initModule; |
286 begin |
267 begin |
287 TotalRounds:= -1; |
268 TotalRounds:= -1; |