28 |
28 |
29 procedure initModule; |
29 procedure initModule; |
30 procedure freeModule; |
30 procedure freeModule; |
31 |
31 |
32 procedure AmmoUsed(am: TAmmoType); |
32 procedure AmmoUsed(am: TAmmoType); |
|
33 procedure HedgehogPoisoned(Gear: PGear; Attacker: PHedgehog); |
33 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean); |
34 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean); |
34 procedure Skipped; |
35 procedure Skipped; |
35 procedure TurnReaction; |
36 procedure TurnReaction; |
36 procedure SendStats; |
37 procedure SendStats; |
37 procedure hedgehogFlight(Gear: PGear; time: Longword); |
38 procedure hedgehogFlight(Gear: PGear; time: Longword); |
43 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uMisc, uConsole, uScript; |
44 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uMisc, uConsole, uScript; |
44 |
45 |
45 var DamageClan : Longword = 0; |
46 var DamageClan : Longword = 0; |
46 DamageTotal : Longword = 0; |
47 DamageTotal : Longword = 0; |
47 DamageTurn : Longword = 0; |
48 DamageTurn : Longword = 0; |
|
49 PoisonTurn : Longword = 0; // Poisoned enemies per turn |
|
50 PoisonClan : Longword = 0; // Poisoned own clan members in turn |
|
51 PoisonTotal : Longword = 0; // Poisoned hogs in whole round |
48 KillsClan : LongWord = 0; |
52 KillsClan : LongWord = 0; |
49 Kills : LongWord = 0; |
53 Kills : LongWord = 0; |
50 KillsTotal : LongWord = 0; |
54 KillsTotal : LongWord = 0; |
51 AmmoUsedCount : Longword = 0; |
55 AmmoUsedCount : Longword = 0; |
52 AmmoDamagingUsed : boolean = false; |
56 AmmoDamagingUsed : boolean = false; |
53 SkippedTurns: LongWord = 0; |
57 SkippedTurns: LongWord = 0; |
54 isTurnSkipped: boolean = false; |
58 isTurnSkipped: boolean = false; |
55 vpHurtSameClan: PVoicepack = nil; |
59 vpHurtSameClan: PVoicepack = nil; |
56 vpHurtEnemy: PVoicepack = nil; |
60 vpHurtEnemy: PVoicepack = nil; |
57 |
61 |
|
62 procedure HedgehogPoisoned(Gear: PGear; Attacker: PHedgehog); |
|
63 begin |
|
64 if Attacker^.Team^.Clan = Gear^.HEdgehog^.Team^.Clan then |
|
65 begin |
|
66 vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack; |
|
67 inc(PoisonClan) |
|
68 end |
|
69 else |
|
70 begin |
|
71 vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack; |
|
72 inc(PoisonTurn) |
|
73 end; |
|
74 inc(PoisonTotal) |
|
75 end; |
|
76 |
58 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean); |
77 procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean); |
59 begin |
78 begin |
60 if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then |
79 if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then |
61 vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack |
80 vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack |
62 else |
81 else |
107 if FinishedTurnsTotal <> 0 then |
126 if FinishedTurnsTotal <> 0 then |
108 begin |
127 begin |
109 s:= ansistring(CurrentHedgehog^.Name); |
128 s:= ansistring(CurrentHedgehog^.Name); |
110 inc(CurrentHedgehog^.stats.FinishedTurns); |
129 inc(CurrentHedgehog^.stats.FinishedTurns); |
111 |
130 |
112 // First blood (first damage or kill) |
131 // First blood (first damage, poison or kill) |
113 if ((DamageTotal > 0) or (KillsTotal > 0)) and ((CurrentHedgehog^.stats.DamageGiven = DamageTotal) and (CurrentHedgehog^.stats.StepKills = KillsTotal)) then |
132 if ((DamageTotal > 0) or (KillsTotal > 0) or (PoisonTotal > 0)) and ((CurrentHedgehog^.stats.DamageGiven = DamageTotal) and (CurrentHedgehog^.stats.StepKills = KillsTotal) and (PoisonTotal = PoisonTurn + PoisonClan)) then |
114 AddVoice(sndFirstBlood, CurrentTeam^.voicepack) |
133 AddVoice(sndFirstBlood, CurrentTeam^.voicepack) |
115 |
134 |
116 // Hog hurts itself only |
135 // Hog hurts itself only |
117 else if CurrentHedgehog^.stats.StepDamageRecv > 0 then |
136 else if CurrentHedgehog^.stats.StepDamageRecv > 0 then |
118 begin |
137 begin |
119 AddVoice(sndStupid, PreviousTeam^.voicepack); |
138 AddVoice(sndStupid, PreviousTeam^.voicepack); |
120 if CurrentHedgehog^.stats.DamageGiven = CurrentHedgehog^.stats.StepDamageRecv then |
139 if CurrentHedgehog^.stats.DamageGiven = CurrentHedgehog^.stats.StepDamageRecv then |
121 AddCaption(FormatA(GetEventString(eidHurtSelf), s), cWhiteColor, capgrpMessage); |
140 AddCaption(FormatA(GetEventString(eidHurtSelf), s), cWhiteColor, capgrpMessage); |
122 end |
141 end |
123 |
142 |
124 // Hog hurts own team/clan |
143 // Hog hurts, poisons or kills own team/clan member |
125 else if (DamageClan <> 0) or (KillsClan <> 0) then |
144 else if (DamageClan <> 0) or (KillsClan <> 0) or (PoisonClan <> 0) then |
126 if (DamageTurn > DamageClan) or (Kills > KillsClan) then |
145 if (DamageTurn > DamageClan) or (Kills > KillsClan) then |
127 if random(2) = 0 then |
146 if random(2) = 0 then |
128 AddVoice(sndNutter, CurrentTeam^.voicepack) |
147 AddVoice(sndNutter, CurrentTeam^.voicepack) |
129 else |
148 else |
130 AddVoice(sndWatchIt, vpHurtSameClan) |
149 AddVoice(sndWatchIt, vpHurtSameClan) |
132 if random(2) = 0 then |
151 if random(2) = 0 then |
133 AddVoice(sndSameTeam, vpHurtSameClan) |
152 AddVoice(sndSameTeam, vpHurtSameClan) |
134 else |
153 else |
135 AddVoice(sndTraitor, vpHurtSameClan) |
154 AddVoice(sndTraitor, vpHurtSameClan) |
136 |
155 |
137 // Hog hurts or kills enemy |
156 // Hog hurts, kills or poisons enemy |
138 else if (CurrentHedgehog^.stats.StepDamageGiven <> 0) or (CurrentHedgehog^.stats.StepKills <> 0) then |
157 else if (CurrentHedgehog^.stats.StepDamageGiven <> 0) or (CurrentHedgehog^.stats.StepKills <> 0) or (PoisonTurn <> 0) then |
139 if Kills > 0 then |
158 if Kills > 0 then |
140 AddVoice(sndEnemyDown, CurrentTeam^.voicepack) |
159 AddVoice(sndEnemyDown, CurrentTeam^.voicepack) |
141 else |
160 else |
142 AddVoice(sndRegret, vpHurtEnemy) |
161 AddVoice(sndRegret, vpHurtEnemy) |
143 |
162 |
144 // Missed shot |
163 // Missed shot |
145 else if AmmoDamagingUsed and (Kills = 0) then |
164 else if AmmoDamagingUsed and (Kills = 0) and (PoisonTurn = 0) and (PoisonClan = 0) and (DamageTurn = 0) then |
146 AddVoice(sndMissed, PreviousTeam^.voicepack) |
165 AddVoice(sndMissed, PreviousTeam^.voicepack) |
147 |
166 |
148 // Timeout |
167 // Timeout |
149 else if (AmmoUsedCount > 0) and (not isTurnSkipped) then |
168 else if (AmmoUsedCount > 0) and (not isTurnSkipped) then |
150 begin end// nothing ? |
169 begin end// nothing ? |