16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 *) |
17 *) |
18 |
18 |
19 unit uStats; |
19 unit uStats; |
20 interface |
20 interface |
21 uses uGears; |
21 uses uGears, uConsts; |
22 |
22 |
23 type TStatistics = record |
23 type TStatistics = record |
24 DamageRecv, |
24 DamageRecv, |
25 DamageGiven: Longword; |
25 DamageGiven: Longword; |
26 StepDamageRecv, |
26 StepDamageRecv, |
28 MaxStepDamageRecv, |
28 MaxStepDamageRecv, |
29 MaxStepDamageGiven: Longword; |
29 MaxStepDamageGiven: Longword; |
30 FinishedTurns: Longword; |
30 FinishedTurns: Longword; |
31 end; |
31 end; |
32 |
32 |
|
33 procedure AmmoUsed(am: TAmmoType); |
33 procedure HedgehogDamaged(Gear: PGear; Damage: Longword); |
34 procedure HedgehogDamaged(Gear: PGear; Damage: Longword); |
34 procedure TurnReaction; |
35 procedure TurnReaction; |
35 procedure SendStats; |
36 procedure SendStats; |
36 |
37 |
37 implementation |
38 implementation |
38 uses uTeams, uSound, uConsts; |
39 uses uTeams, uSound; |
39 var DamageGiven : Longword = 0; |
40 var DamageGiven : Longword = 0; |
40 DamageClan : Longword = 0; |
41 DamageClan : Longword = 0; |
|
42 DamageTotal : Longword = 0; |
41 |
43 |
42 procedure HedgehogDamaged(Gear: PGear; Damage: Longword); |
44 procedure HedgehogDamaged(Gear: PGear; Damage: Longword); |
43 begin |
45 begin |
44 if Gear <> CurrentHedgehog^.Gear then |
46 if Gear <> CurrentHedgehog^.Gear then |
45 inc(CurrentHedgehog^.stats.StepDamageGiven, Damage); |
47 inc(CurrentHedgehog^.stats.StepDamageGiven, Damage); |
46 |
48 |
47 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Damage); |
49 if CurrentHedgehog^.Team^.Clan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan then inc(DamageClan, Damage); |
48 |
50 |
49 |
51 |
50 inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Damage); |
52 inc(PHedgehog(Gear^.Hedgehog)^.stats.StepDamageRecv, Damage); |
51 inc(DamageGiven, Damage) |
53 inc(DamageGiven, Damage); |
|
54 inc(DamageTotal, Damage) |
52 end; |
55 end; |
53 |
56 |
54 procedure TurnReaction; |
57 procedure TurnReaction; |
55 var Gear: PGear; |
58 var Gear: PGear; |
56 begin |
59 begin |
57 inc(CurrentHedgehog^.stats.FinishedTurns); |
60 inc(CurrentHedgehog^.stats.FinishedTurns); |
58 |
61 |
59 if CurrentHedgehog^.stats.StepDamageRecv > 0 then PlaySound(sndStupid, false) |
62 if (DamageGiven = DamageTotal) and (DamageTotal > 0) then PlaySound(sndFirstBlood, false) |
|
63 else if CurrentHedgehog^.stats.StepDamageRecv > 0 then PlaySound(sndStupid, false) |
60 else if DamageClan <> 0 then |
64 else if DamageClan <> 0 then |
61 else if DamageGiven <> 0 then |
65 else if DamageGiven <> 0 then |
62 else PlaySound(sndMissed, false); |
66 else PlaySound(sndMissed, false); |
63 |
67 |
64 Gear:= GearsList; |
68 Gear:= GearsList; |