author | Wuzzy <almikes@aol.com> |
Wed, 19 Apr 2017 22:26:24 +0200 | |
changeset 12291 | e2b30aba00e1 |
parent 12290 | 4ce7cb441c75 |
child 12292 | 93434ab299a0 |
permissions | -rw-r--r-- |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
4 |
* |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
8 |
* |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
13 |
* |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
10105
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
17 |
*) |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
18 |
|
2630 | 19 |
{$INCLUDE "options.inc"} |
20 |
||
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
21 |
unit uStats; |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
22 |
interface |
4370 | 23 |
uses uConsts, uTypes; |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
24 |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
25 |
var TotalRounds: LongInt; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
26 |
FinishedTurnsTotal: LongInt; |
9180
d19c09670ec8
changed variable and function name
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9174
diff
changeset
|
27 |
SendHealthStatsOn : boolean = true; |
10015 | 28 |
|
3038 | 29 |
procedure initModule; |
30 |
procedure freeModule; |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
31 |
|
829 | 32 |
procedure AmmoUsed(am: TAmmoType); |
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
33 |
procedure HedgehogPoisoned(Gear: PGear; Attacker: PHedgehog); |
5202 | 34 |
procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean); |
871 | 35 |
procedure Skipped; |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
36 |
procedure TurnReaction; |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
37 |
procedure SendStats; |
6014 | 38 |
procedure hedgehogFlight(Gear: PGear; time: Longword); |
9409 | 39 |
procedure declareAchievement(id, teamname, location: shortstring; value: LongInt); |
11569 | 40 |
procedure startGhostPoints(n: LongInt); |
41 |
procedure dumpPoint(x, y: LongInt); |
|
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
42 |
|
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
43 |
implementation |
11532 | 44 |
uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uMisc, uConsole, uScript; |
4359 | 45 |
|
5203
b77f28facca6
Better tracking of damage source and target when scoring a turn
unc0rr
parents:
5202
diff
changeset
|
46 |
var DamageClan : Longword = 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
47 |
DamageTotal : Longword = 0; |
8717
6e1ccd678e8a
this should ensure those other voices play a bit more often.
nemo
parents:
7932
diff
changeset
|
48 |
DamageTurn : Longword = 0; |
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
49 |
PoisonTurn : Longword = 0; // Poisoned enemies per turn |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
50 |
PoisonClan : Longword = 0; // Poisoned own clan members in turn |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
51 |
PoisonTotal : Longword = 0; // Poisoned hogs in whole round |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
52 |
KillsClan : LongWord = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
53 |
Kills : LongWord = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
54 |
KillsTotal : LongWord = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
55 |
AmmoUsedCount : Longword = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
56 |
AmmoDamagingUsed : boolean = false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
57 |
SkippedTurns: LongWord = 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
58 |
isTurnSkipped: boolean = false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
59 |
vpHurtSameClan: PVoicepack = nil; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
60 |
vpHurtEnemy: PVoicepack = nil; |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
61 |
|
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
62 |
procedure HedgehogPoisoned(Gear: PGear; Attacker: PHedgehog); |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
63 |
begin |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
64 |
if Attacker^.Team^.Clan = Gear^.HEdgehog^.Team^.Clan then |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
65 |
begin |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
66 |
vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
67 |
inc(PoisonClan) |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
68 |
end |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
69 |
else |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
70 |
begin |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
71 |
vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
72 |
inc(PoisonTurn) |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
73 |
end; |
12290
4ce7cb441c75
Call hedgehogs stupid for poisoning themselves
Wuzzy <almikes@aol.com>
parents:
12176
diff
changeset
|
74 |
Gear^.Hedgehog^.stats.StepPoisoned:= true; |
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
75 |
inc(PoisonTotal) |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
76 |
end; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
77 |
|
5202 | 78 |
procedure HedgehogDamaged(Gear: PGear; Attacker: PHedgehog; Damage: Longword; killed: boolean); |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
79 |
begin |
4837
2ea0a152c319
Pass PHedgehog instead of PGear to stats. Fixes crash.
unc0rr
parents:
4824
diff
changeset
|
80 |
if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
81 |
vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack |
1678 | 82 |
else |
4365 | 83 |
vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack; |
1678 | 84 |
|
85 |
////////////////////////// |
|
86 |
||
5203
b77f28facca6
Better tracking of damage source and target when scoring a turn
unc0rr
parents:
5202
diff
changeset
|
87 |
inc(Attacker^.stats.StepDamageGiven, Damage); |
b77f28facca6
Better tracking of damage source and target when scoring a turn
unc0rr
parents:
5202
diff
changeset
|
88 |
inc(Attacker^.stats.DamageGiven, Damage); |
b77f28facca6
Better tracking of damage source and target when scoring a turn
unc0rr
parents:
5202
diff
changeset
|
89 |
inc(Gear^.Hedgehog^.stats.StepDamageRecv, Damage); |
815 | 90 |
|
5202 | 91 |
if CurrentHedgehog^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then inc(DamageClan, Damage); |
815 | 92 |
|
5202 | 93 |
if killed then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
94 |
begin |
5142
cb822f8d52ff
Show winners in console in a special form so this information could be easily parsed
unc0rr
parents:
4976
diff
changeset
|
95 |
inc(Attacker^.stats.StepKills); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
96 |
inc(Kills); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
97 |
inc(KillsTotal); |
5142
cb822f8d52ff
Show winners in console in a special form so this information could be easily parsed
unc0rr
parents:
4976
diff
changeset
|
98 |
inc(Attacker^.Team^.stats.Kills); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
99 |
if (Attacker^.Team^.TeamName = Gear^.Hedgehog^.Team^.TeamName) then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
100 |
begin |
5142
cb822f8d52ff
Show winners in console in a special form so this information could be easily parsed
unc0rr
parents:
4976
diff
changeset
|
101 |
inc(Attacker^.Team^.stats.TeamKills); |
cb822f8d52ff
Show winners in console in a special form so this information could be easily parsed
unc0rr
parents:
4976
diff
changeset
|
102 |
inc(Attacker^.Team^.stats.TeamDamage, Gear^.Damage); |
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
103 |
end; |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
104 |
if Gear = Attacker^.Gear then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
105 |
inc(Attacker^.Team^.stats.Suicides); |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
106 |
if Attacker^.Team^.Clan = Gear^.Hedgehog^.Team^.Clan then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
107 |
inc(KillsClan); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
108 |
end; |
815 | 109 |
|
8717
6e1ccd678e8a
this should ensure those other voices play a bit more often.
nemo
parents:
7932
diff
changeset
|
110 |
inc(DamageTotal, Damage); |
6e1ccd678e8a
this should ensure those other voices play a bit more often.
nemo
parents:
7932
diff
changeset
|
111 |
inc(DamageTurn, Damage) |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
112 |
end; |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
113 |
|
871 | 114 |
procedure Skipped; |
115 |
begin |
|
116 |
inc(SkippedTurns); |
|
117 |
isTurnSkipped:= true |
|
118 |
end; |
|
119 |
||
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
120 |
procedure TurnReaction; |
874 | 121 |
var i, t: LongInt; |
10127 | 122 |
s: ansistring; |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
123 |
begin |
11532 | 124 |
//TryDo(not bBetweenTurns, 'Engine bug: TurnReaction between turns', true); |
1054 | 125 |
|
870 | 126 |
inc(FinishedTurnsTotal); |
1625 | 127 |
if FinishedTurnsTotal <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
128 |
begin |
10127 | 129 |
s:= ansistring(CurrentHedgehog^.Name); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
130 |
inc(CurrentHedgehog^.stats.FinishedTurns); |
870 | 131 |
|
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
132 |
// First blood (first damage, poison or kill) |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
133 |
if ((DamageTotal > 0) or (KillsTotal > 0) or (PoisonTotal > 0)) and ((CurrentHedgehog^.stats.DamageGiven = DamageTotal) and (CurrentHedgehog^.stats.StepKills = KillsTotal) and (PoisonTotal = PoisonTurn + PoisonClan)) then |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
134 |
AddVoice(sndFirstBlood, CurrentTeam^.voicepack) |
815 | 135 |
|
12291 | 136 |
// Hog hurts, poisons or kills itself |
137 |
else if (CurrentHedgehog^.stats.StepDamageRecv > 0) or (CurrentHedgehog^.stats.StepPoisoned) or (CurrentHedgehog^.Gear = nil) then |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
138 |
begin |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
139 |
AddVoice(sndStupid, PreviousTeam^.voicepack); |
12291 | 140 |
// Message for hurting itself only (not drowning) |
141 |
if (CurrentHedgehog^.stats.DamageGiven = CurrentHedgehog^.stats.StepDamageRecv) and (CurrentHedgehog^.stats.StepDamageRecv >= 1) then |
|
10127 | 142 |
AddCaption(FormatA(GetEventString(eidHurtSelf), s), cWhiteColor, capgrpMessage); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
143 |
end |
5203
b77f28facca6
Better tracking of damage source and target when scoring a turn
unc0rr
parents:
5202
diff
changeset
|
144 |
|
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
145 |
// Hog hurts, poisons or kills own team/clan member |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
146 |
else if (DamageClan <> 0) or (KillsClan <> 0) or (PoisonClan <> 0) then |
12157
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12095
diff
changeset
|
147 |
if (DamageTurn > DamageClan) or (Kills > KillsClan) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
148 |
if random(2) = 0 then |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
149 |
AddVoice(sndNutter, CurrentTeam^.voicepack) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
150 |
else |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
151 |
AddVoice(sndWatchIt, vpHurtSameClan) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
152 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
153 |
if random(2) = 0 then |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
154 |
AddVoice(sndSameTeam, vpHurtSameClan) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
155 |
else |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
156 |
AddVoice(sndTraitor, vpHurtSameClan) |
5203
b77f28facca6
Better tracking of damage source and target when scoring a turn
unc0rr
parents:
5202
diff
changeset
|
157 |
|
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
158 |
// Hog hurts, kills or poisons enemy |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
159 |
else if (CurrentHedgehog^.stats.StepDamageGiven <> 0) or (CurrentHedgehog^.stats.StepKills <> 0) or (PoisonTurn <> 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
160 |
if Kills > 0 then |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
161 |
AddVoice(sndEnemyDown, CurrentTeam^.voicepack) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
162 |
else |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
163 |
AddVoice(sndRegret, vpHurtEnemy) |
1625 | 164 |
|
12157
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12095
diff
changeset
|
165 |
// Missed shot |
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
166 |
else if AmmoDamagingUsed and (Kills = 0) and (PoisonTurn = 0) and (PoisonClan = 0) and (DamageTurn = 0) then |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
167 |
AddVoice(sndMissed, PreviousTeam^.voicepack) |
12157
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12095
diff
changeset
|
168 |
|
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12095
diff
changeset
|
169 |
// Timeout |
6290 | 170 |
else if (AmmoUsedCount > 0) and (not isTurnSkipped) then |
6453
11c578d30bd3
Countless imporvements to the parser and countless help to the parser in sources.
unc0rr
parents:
6290
diff
changeset
|
171 |
begin end// nothing ? |
12157
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12095
diff
changeset
|
172 |
|
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12095
diff
changeset
|
173 |
// Turn skipped |
12095
e1bca1ebbad9
fix problem with pas2c build. please don't use "and not xyz", use "and (not xyz)"
sheepluva
parents:
11914
diff
changeset
|
174 |
else if isTurnSkipped and (not PlacingHogs) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
175 |
begin |
11914
c9bad8a01185
Play countdown sounds for 4-1 remaining seconds and “boring” voice on timeout
Wuzzy <almikes@aol.com>
parents:
11569
diff
changeset
|
176 |
AddVoice(sndCoward, PreviousTeam^.voicepack); |
10127 | 177 |
AddCaption(FormatA(GetEventString(eidTurnSkipped), s), cWhiteColor, capgrpMessage); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
178 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
179 |
end; |
870 | 180 |
|
815 | 181 |
|
1625 | 182 |
for t:= 0 to Pred(TeamsCount) do // send even on zero turn |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
183 |
with TeamsArray[t]^ do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
184 |
for i:= 0 to cMaxHHIndex do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
185 |
with Hedgehogs[i].stats do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
186 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
187 |
inc(DamageRecv, StepDamageRecv); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
188 |
inc(DamageGiven, StepDamageGiven); |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
189 |
if StepDamageRecv > MaxStepDamageRecv then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
190 |
MaxStepDamageRecv:= StepDamageRecv; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
191 |
if StepDamageGiven > MaxStepDamageGiven then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
192 |
MaxStepDamageGiven:= StepDamageGiven; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
193 |
if StepKills > MaxStepKills then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
194 |
MaxStepKills:= StepKills; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
195 |
StepKills:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
196 |
StepDamageRecv:= 0; |
12290
4ce7cb441c75
Call hedgehogs stupid for poisoning themselves
Wuzzy <almikes@aol.com>
parents:
12176
diff
changeset
|
197 |
StepDamageGiven:= 0; |
4ce7cb441c75
Call hedgehogs stupid for poisoning themselves
Wuzzy <almikes@aol.com>
parents:
12176
diff
changeset
|
198 |
StepPoisoned:= false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
199 |
end; |
10015 | 200 |
|
9180
d19c09670ec8
changed variable and function name
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9174
diff
changeset
|
201 |
if SendHealthStatsOn then |
9405 | 202 |
for t:= 0 to Pred(ClansCount) do |
203 |
with ClansArray[t]^ do |
|
204 |
begin |
|
205 |
SendStat(siClanHealth, IntToStr(Color) + ' ' + IntToStr(ClanHealth)); |
|
206 |
end; |
|
1625 | 207 |
|
867 | 208 |
Kills:= 0; |
209 |
KillsClan:= 0; |
|
830
f07267032194
- Add statistics info for ammo used in step and whether it is damaging ammo
unc0rr
parents:
829
diff
changeset
|
210 |
DamageClan:= 0; |
8717
6e1ccd678e8a
this should ensure those other voices play a bit more often.
nemo
parents:
7932
diff
changeset
|
211 |
DamageTurn:= 0; |
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
212 |
PoisonClan:= 0; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
213 |
PoisonTurn:= 0; |
830
f07267032194
- Add statistics info for ammo used in step and whether it is damaging ammo
unc0rr
parents:
829
diff
changeset
|
214 |
AmmoUsedCount:= 0; |
871 | 215 |
AmmoDamagingUsed:= false; |
216 |
isTurnSkipped:= false |
|
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
217 |
end; |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
218 |
|
829 | 219 |
procedure AmmoUsed(am: TAmmoType); |
220 |
begin |
|
830
f07267032194
- Add statistics info for ammo used in step and whether it is damaging ammo
unc0rr
parents:
829
diff
changeset
|
221 |
inc(AmmoUsedCount); |
f07267032194
- Add statistics info for ammo used in step and whether it is damaging ammo
unc0rr
parents:
829
diff
changeset
|
222 |
AmmoDamagingUsed:= AmmoDamagingUsed or Ammoz[am].isDamaging |
829 | 223 |
end; |
224 |
||
6014 | 225 |
procedure hedgehogFlight(Gear: PGear; time: Longword); |
226 |
begin |
|
227 |
if time > 4000 then |
|
228 |
begin |
|
7932
ebe1d112e439
remove mobile ifdefs, replace writeLn's for WriteLnToConsole
Xeli
parents:
7857
diff
changeset
|
229 |
WriteLnToConsole('FLIGHT'); |
ebe1d112e439
remove mobile ifdefs, replace writeLn's for WriteLnToConsole
Xeli
parents:
7857
diff
changeset
|
230 |
WriteLnToConsole(Gear^.Hedgehog^.Team^.TeamName); |
ebe1d112e439
remove mobile ifdefs, replace writeLn's for WriteLnToConsole
Xeli
parents:
7857
diff
changeset
|
231 |
WriteLnToConsole(inttostr(time)); |
ebe1d112e439
remove mobile ifdefs, replace writeLn's for WriteLnToConsole
Xeli
parents:
7857
diff
changeset
|
232 |
WriteLnToConsole( ''); |
6014 | 233 |
end |
234 |
end; |
|
235 |
||
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
236 |
procedure SendStats; |
858 | 237 |
var i, t: LongInt; |
869 | 238 |
msd, msk: Longword; msdhh, mskhh: PHedgehog; |
239 |
mskcnt: Longword; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
240 |
maxTeamKills : Longword; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
241 |
maxTeamKillsName : shortstring; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
242 |
maxTurnSkips : Longword; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
243 |
maxTurnSkipsName : shortstring; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
244 |
maxTeamDamage : Longword; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
245 |
maxTeamDamageName : shortstring; |
5142
cb822f8d52ff
Show winners in console in a special form so this information could be easily parsed
unc0rr
parents:
4976
diff
changeset
|
246 |
winnersClan : PClan; |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
247 |
begin |
9180
d19c09670ec8
changed variable and function name
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9174
diff
changeset
|
248 |
if SendHealthStatsOn then |
9405 | 249 |
msd:= 0; msdhh:= nil; |
250 |
msk:= 0; mskhh:= nil; |
|
251 |
mskcnt:= 0; |
|
252 |
maxTeamKills := 0; |
|
253 |
maxTurnSkips := 0; |
|
254 |
maxTeamDamage := 0; |
|
255 |
winnersClan:= nil; |
|
869 | 256 |
|
9405 | 257 |
for t:= 0 to Pred(TeamsCount) do |
258 |
with TeamsArray[t]^ do |
|
259 |
begin |
|
260 |
if not ExtDriven then |
|
261 |
SendStat(siTeamStats, GetTeamStatString(TeamsArray[t])); |
|
262 |
for i:= 0 to cMaxHHIndex do |
|
263 |
begin |
|
264 |
if Hedgehogs[i].stats.MaxStepDamageGiven > msd then |
|
265 |
begin |
|
266 |
msdhh:= @Hedgehogs[i]; |
|
267 |
msd:= Hedgehogs[i].stats.MaxStepDamageGiven |
|
268 |
end; |
|
269 |
if Hedgehogs[i].stats.MaxStepKills >= msk then |
|
270 |
if Hedgehogs[i].stats.MaxStepKills = msk then |
|
271 |
inc(mskcnt) |
|
272 |
else |
|
273 |
begin |
|
274 |
mskcnt:= 1; |
|
275 |
mskhh:= @Hedgehogs[i]; |
|
276 |
msk:= Hedgehogs[i].stats.MaxStepKills |
|
277 |
end; |
|
278 |
end; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
279 |
|
9405 | 280 |
{ send player stats for winner teams } |
281 |
if Clan^.ClanHealth > 0 then |
|
282 |
begin |
|
283 |
winnersClan:= Clan; |
|
284 |
SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' + |
|
285 |
IntToStr(stats.Kills) + ' ' + TeamName); |
|
286 |
end; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
287 |
|
9405 | 288 |
{ determine maximum values of TeamKills, TurnSkips, TeamDamage } |
289 |
if stats.TeamKills > maxTeamKills then |
|
290 |
begin |
|
291 |
maxTeamKills := stats.TeamKills; |
|
292 |
maxTeamKillsName := TeamName; |
|
293 |
end; |
|
294 |
if stats.TurnSkips > maxTurnSkips then |
|
295 |
begin |
|
296 |
maxTurnSkips := stats.TurnSkips; |
|
297 |
maxTurnSkipsName := TeamName; |
|
298 |
end; |
|
299 |
if stats.TeamDamage > maxTeamDamage then |
|
300 |
begin |
|
301 |
maxTeamDamage := stats.TeamDamage; |
|
302 |
maxTeamDamageName := TeamName; |
|
303 |
end; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
304 |
|
9405 | 305 |
end; |
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
306 |
|
9405 | 307 |
{ now send player stats for loser teams } |
308 |
for t:= 0 to Pred(TeamsCount) do |
|
309 |
begin |
|
310 |
with TeamsArray[t]^ do |
|
311 |
begin |
|
312 |
if Clan^.ClanHealth = 0 then |
|
313 |
begin |
|
314 |
SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' + |
|
315 |
IntToStr(stats.Kills) + ' ' + TeamName); |
|
316 |
end; |
|
317 |
end; |
|
318 |
end; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
319 |
|
9405 | 320 |
if msdhh <> nil then |
321 |
SendStat(siMaxStepDamage, IntToStr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')'); |
|
322 |
if mskcnt = 1 then |
|
323 |
SendStat(siMaxStepKills, IntToStr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')'); |
|
869 | 324 |
|
9405 | 325 |
if maxTeamKills > 1 then |
326 |
SendStat(siMaxTeamKills, IntToStr(maxTeamKills) + ' ' + maxTeamKillsName); |
|
327 |
if maxTurnSkips > 2 then |
|
328 |
SendStat(siMaxTurnSkips, IntToStr(maxTurnSkips) + ' ' + maxTurnSkipsName); |
|
329 |
if maxTeamDamage > 30 then |
|
330 |
SendStat(siMaxTeamDamage, IntToStr(maxTeamDamage) + ' ' + maxTeamDamageName); |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
331 |
|
9405 | 332 |
if KilledHHs > 0 then |
333 |
SendStat(siKilledHHs, IntToStr(KilledHHs)); |
|
5142
cb822f8d52ff
Show winners in console in a special form so this information could be easily parsed
unc0rr
parents:
4976
diff
changeset
|
334 |
|
9405 | 335 |
// now to console |
10015 | 336 |
if winnersClan <> nil then |
9405 | 337 |
begin |
338 |
WriteLnToConsole('WINNERS'); |
|
9397 | 339 |
WriteLnToConsole(inttostr(winnersClan^.TeamsNumber)); |
9405 | 340 |
for t:= 0 to winnersClan^.TeamsNumber - 1 do |
341 |
WriteLnToConsole(winnersClan^.Teams[t]^.TeamName); |
|
342 |
end |
|
343 |
else |
|
344 |
WriteLnToConsole('DRAW'); |
|
10015 | 345 |
|
9397 | 346 |
ScriptCall('onAchievementsDeclaration'); |
347 |
end; |
|
6014 | 348 |
|
9409 | 349 |
procedure declareAchievement(id, teamname, location: shortstring; value: LongInt); |
10015 | 350 |
begin |
9411
d95ac9992529
Fix script flaw in detection of best team when sending achievement info
unc0rr
parents:
9409
diff
changeset
|
351 |
if (length(id) = 0) or (length(teamname) = 0) or (length(location) = 0) then exit; |
9397 | 352 |
WriteLnToConsole('ACHIEVEMENT'); |
353 |
WriteLnToConsole(id); |
|
354 |
WriteLnToConsole(teamname); |
|
9409 | 355 |
WriteLnToConsole(location); |
9397 | 356 |
WriteLnToConsole(inttostr(value)); |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
357 |
end; |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
358 |
|
11569 | 359 |
procedure startGhostPoints(n: LongInt); |
360 |
begin |
|
361 |
WriteLnToConsole('GHOST_POINTS'); |
|
362 |
WriteLnToConsole(inttostr(n)); |
|
363 |
end; |
|
364 |
||
365 |
procedure dumpPoint(x, y: LongInt); |
|
366 |
begin |
|
367 |
WriteLnToConsole(inttostr(x)); |
|
368 |
WriteLnToConsole(inttostr(y)); |
|
369 |
end; |
|
370 |
||
3038 | 371 |
procedure initModule; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
372 |
begin |
11569 | 373 |
DamageClan := 0; |
374 |
DamageTotal := 0; |
|
375 |
DamageTurn := 0; |
|
12176
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
376 |
PoisonClan := 0; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12157
diff
changeset
|
377 |
PoisonTurn := 0; |
11569 | 378 |
KillsClan := 0; |
379 |
Kills := 0; |
|
380 |
KillsTotal := 0; |
|
381 |
AmmoUsedCount := 0; |
|
382 |
AmmoDamagingUsed := false; |
|
383 |
SkippedTurns:= 0; |
|
384 |
isTurnSkipped:= false; |
|
385 |
vpHurtSameClan:= nil; |
|
386 |
vpHurtEnemy:= nil; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
387 |
TotalRounds:= -1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
388 |
FinishedTurnsTotal:= -1; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
389 |
end; |
3697 | 390 |
|
3038 | 391 |
procedure freeModule; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
392 |
begin |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
393 |
end; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
394 |
|
2619 | 395 |
end. |