author | Wuzzy <almikes@aol.com> |
Wed, 19 Apr 2017 22:10:12 +0200 | |
changeset 12295 | 4ce7cb441c75 |
parent 12181 | 29f1ea94488b |
child 12296 | e2b30aba00e1 |
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); |
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
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); |
11574 | 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 |
11537 | 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; |
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
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:
12162
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:
12162
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 |
|
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
62 |
procedure HedgehogPoisoned(Gear: PGear; Attacker: PHedgehog); |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
63 |
begin |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
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:
12162
diff
changeset
|
65 |
begin |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
66 |
vpHurtSameClan:= CurrentHedgehog^.Team^.voicepack; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
67 |
inc(PoisonClan) |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
68 |
end |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
69 |
else |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
70 |
begin |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
71 |
vpHurtEnemy:= Gear^.Hedgehog^.Team^.voicepack; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
72 |
inc(PoisonTurn) |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
73 |
end; |
12295
4ce7cb441c75
Call hedgehogs stupid for poisoning themselves
Wuzzy <almikes@aol.com>
parents:
12181
diff
changeset
|
74 |
Gear^.Hedgehog^.stats.StepPoisoned:= true; |
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
75 |
inc(PoisonTotal) |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
76 |
end; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
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 |
11537 | 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 |
|
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
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:
12162
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 |
|
12295
4ce7cb441c75
Call hedgehogs stupid for poisoning themselves
Wuzzy <almikes@aol.com>
parents:
12181
diff
changeset
|
136 |
// Hog hurts or poisons itself |
4ce7cb441c75
Call hedgehogs stupid for poisoning themselves
Wuzzy <almikes@aol.com>
parents:
12181
diff
changeset
|
137 |
else if (CurrentHedgehog^.stats.StepDamageRecv > 0) or (CurrentHedgehog^.stats.StepPoisoned) 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); |
10015 | 140 |
if CurrentHedgehog^.stats.DamageGiven = CurrentHedgehog^.stats.StepDamageRecv then |
10127 | 141 |
AddCaption(FormatA(GetEventString(eidHurtSelf), s), cWhiteColor, capgrpMessage); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
142 |
end |
5203
b77f28facca6
Better tracking of damage source and target when scoring a turn
unc0rr
parents:
5202
diff
changeset
|
143 |
|
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
144 |
// Hog hurts, poisons or kills own team/clan member |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
145 |
else if (DamageClan <> 0) or (KillsClan <> 0) or (PoisonClan <> 0) then |
12162
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12100
diff
changeset
|
146 |
if (DamageTurn > DamageClan) or (Kills > KillsClan) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
147 |
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
|
148 |
AddVoice(sndNutter, CurrentTeam^.voicepack) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
149 |
else |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
150 |
AddVoice(sndWatchIt, vpHurtSameClan) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
151 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
152 |
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
|
153 |
AddVoice(sndSameTeam, vpHurtSameClan) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
154 |
else |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
155 |
AddVoice(sndTraitor, vpHurtSameClan) |
5203
b77f28facca6
Better tracking of damage source and target when scoring a turn
unc0rr
parents:
5202
diff
changeset
|
156 |
|
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
157 |
// Hog hurts, kills or poisons enemy |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
158 |
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
|
159 |
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
|
160 |
AddVoice(sndEnemyDown, CurrentTeam^.voicepack) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
161 |
else |
5638
e35ba2a400d8
Try to avoid overlapping voices for major statements (not things like byebye or oof)
nemo
parents:
5203
diff
changeset
|
162 |
AddVoice(sndRegret, vpHurtEnemy) |
1625 | 163 |
|
12162
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12100
diff
changeset
|
164 |
// Missed shot |
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
165 |
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
|
166 |
AddVoice(sndMissed, PreviousTeam^.voicepack) |
12162
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12100
diff
changeset
|
167 |
|
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12100
diff
changeset
|
168 |
// Timeout |
6290 | 169 |
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
|
170 |
begin end// nothing ? |
12162
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12100
diff
changeset
|
171 |
|
e837912ba85d
Fix hedgehogs/ticker ignoring kills without damage (#149)
Wuzzy <almikes@aol.com>
parents:
12100
diff
changeset
|
172 |
// Turn skipped |
12100
e1bca1ebbad9
fix problem with pas2c build. please don't use "and not xyz", use "and (not xyz)"
sheepluva
parents:
11919
diff
changeset
|
173 |
else if isTurnSkipped and (not PlacingHogs) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
174 |
begin |
11919
c9bad8a01185
Play countdown sounds for 4-1 remaining seconds and “boring” voice on timeout
Wuzzy <almikes@aol.com>
parents:
11574
diff
changeset
|
175 |
AddVoice(sndCoward, PreviousTeam^.voicepack); |
10127 | 176 |
AddCaption(FormatA(GetEventString(eidTurnSkipped), s), cWhiteColor, capgrpMessage); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
177 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
178 |
end; |
870 | 179 |
|
815 | 180 |
|
1625 | 181 |
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
|
182 |
with TeamsArray[t]^ do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
183 |
for i:= 0 to cMaxHHIndex do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
184 |
with Hedgehogs[i].stats do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
185 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
186 |
inc(DamageRecv, StepDamageRecv); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
187 |
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
|
188 |
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
|
189 |
MaxStepDamageRecv:= StepDamageRecv; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
190 |
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
|
191 |
MaxStepDamageGiven:= StepDamageGiven; |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6453
diff
changeset
|
192 |
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
|
193 |
MaxStepKills:= StepKills; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
194 |
StepKills:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
195 |
StepDamageRecv:= 0; |
12295
4ce7cb441c75
Call hedgehogs stupid for poisoning themselves
Wuzzy <almikes@aol.com>
parents:
12181
diff
changeset
|
196 |
StepDamageGiven:= 0; |
4ce7cb441c75
Call hedgehogs stupid for poisoning themselves
Wuzzy <almikes@aol.com>
parents:
12181
diff
changeset
|
197 |
StepPoisoned:= false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
198 |
end; |
10015 | 199 |
|
9180
d19c09670ec8
changed variable and function name
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9174
diff
changeset
|
200 |
if SendHealthStatsOn then |
9405 | 201 |
for t:= 0 to Pred(ClansCount) do |
202 |
with ClansArray[t]^ do |
|
203 |
begin |
|
204 |
SendStat(siClanHealth, IntToStr(Color) + ' ' + IntToStr(ClanHealth)); |
|
205 |
end; |
|
1625 | 206 |
|
867 | 207 |
Kills:= 0; |
208 |
KillsClan:= 0; |
|
830
f07267032194
- Add statistics info for ammo used in step and whether it is damaging ammo
unc0rr
parents:
829
diff
changeset
|
209 |
DamageClan:= 0; |
8717
6e1ccd678e8a
this should ensure those other voices play a bit more often.
nemo
parents:
7932
diff
changeset
|
210 |
DamageTurn:= 0; |
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
211 |
PoisonClan:= 0; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
212 |
PoisonTurn:= 0; |
830
f07267032194
- Add statistics info for ammo used in step and whether it is damaging ammo
unc0rr
parents:
829
diff
changeset
|
213 |
AmmoUsedCount:= 0; |
871 | 214 |
AmmoDamagingUsed:= false; |
215 |
isTurnSkipped:= false |
|
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
216 |
end; |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
217 |
|
829 | 218 |
procedure AmmoUsed(am: TAmmoType); |
219 |
begin |
|
830
f07267032194
- Add statistics info for ammo used in step and whether it is damaging ammo
unc0rr
parents:
829
diff
changeset
|
220 |
inc(AmmoUsedCount); |
f07267032194
- Add statistics info for ammo used in step and whether it is damaging ammo
unc0rr
parents:
829
diff
changeset
|
221 |
AmmoDamagingUsed:= AmmoDamagingUsed or Ammoz[am].isDamaging |
829 | 222 |
end; |
223 |
||
6014 | 224 |
procedure hedgehogFlight(Gear: PGear; time: Longword); |
225 |
begin |
|
226 |
if time > 4000 then |
|
227 |
begin |
|
7932
ebe1d112e439
remove mobile ifdefs, replace writeLn's for WriteLnToConsole
Xeli
parents:
7857
diff
changeset
|
228 |
WriteLnToConsole('FLIGHT'); |
ebe1d112e439
remove mobile ifdefs, replace writeLn's for WriteLnToConsole
Xeli
parents:
7857
diff
changeset
|
229 |
WriteLnToConsole(Gear^.Hedgehog^.Team^.TeamName); |
ebe1d112e439
remove mobile ifdefs, replace writeLn's for WriteLnToConsole
Xeli
parents:
7857
diff
changeset
|
230 |
WriteLnToConsole(inttostr(time)); |
ebe1d112e439
remove mobile ifdefs, replace writeLn's for WriteLnToConsole
Xeli
parents:
7857
diff
changeset
|
231 |
WriteLnToConsole( ''); |
6014 | 232 |
end |
233 |
end; |
|
234 |
||
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
235 |
procedure SendStats; |
858 | 236 |
var i, t: LongInt; |
869 | 237 |
msd, msk: Longword; msdhh, mskhh: PHedgehog; |
238 |
mskcnt: Longword; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
239 |
maxTeamKills : Longword; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
240 |
maxTeamKillsName : shortstring; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
241 |
maxTurnSkips : Longword; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
242 |
maxTurnSkipsName : shortstring; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
243 |
maxTeamDamage : Longword; |
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
244 |
maxTeamDamageName : shortstring; |
5142
cb822f8d52ff
Show winners in console in a special form so this information could be easily parsed
unc0rr
parents:
4976
diff
changeset
|
245 |
winnersClan : PClan; |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
246 |
begin |
9180
d19c09670ec8
changed variable and function name
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9174
diff
changeset
|
247 |
if SendHealthStatsOn then |
9405 | 248 |
msd:= 0; msdhh:= nil; |
249 |
msk:= 0; mskhh:= nil; |
|
250 |
mskcnt:= 0; |
|
251 |
maxTeamKills := 0; |
|
252 |
maxTurnSkips := 0; |
|
253 |
maxTeamDamage := 0; |
|
254 |
winnersClan:= nil; |
|
869 | 255 |
|
9405 | 256 |
for t:= 0 to Pred(TeamsCount) do |
257 |
with TeamsArray[t]^ do |
|
258 |
begin |
|
259 |
if not ExtDriven then |
|
260 |
SendStat(siTeamStats, GetTeamStatString(TeamsArray[t])); |
|
261 |
for i:= 0 to cMaxHHIndex do |
|
262 |
begin |
|
263 |
if Hedgehogs[i].stats.MaxStepDamageGiven > msd then |
|
264 |
begin |
|
265 |
msdhh:= @Hedgehogs[i]; |
|
266 |
msd:= Hedgehogs[i].stats.MaxStepDamageGiven |
|
267 |
end; |
|
268 |
if Hedgehogs[i].stats.MaxStepKills >= msk then |
|
269 |
if Hedgehogs[i].stats.MaxStepKills = msk then |
|
270 |
inc(mskcnt) |
|
271 |
else |
|
272 |
begin |
|
273 |
mskcnt:= 1; |
|
274 |
mskhh:= @Hedgehogs[i]; |
|
275 |
msk:= Hedgehogs[i].stats.MaxStepKills |
|
276 |
end; |
|
277 |
end; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
278 |
|
9405 | 279 |
{ send player stats for winner teams } |
280 |
if Clan^.ClanHealth > 0 then |
|
281 |
begin |
|
282 |
winnersClan:= Clan; |
|
283 |
SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' + |
|
284 |
IntToStr(stats.Kills) + ' ' + TeamName); |
|
285 |
end; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
286 |
|
9405 | 287 |
{ determine maximum values of TeamKills, TurnSkips, TeamDamage } |
288 |
if stats.TeamKills > maxTeamKills then |
|
289 |
begin |
|
290 |
maxTeamKills := stats.TeamKills; |
|
291 |
maxTeamKillsName := TeamName; |
|
292 |
end; |
|
293 |
if stats.TurnSkips > maxTurnSkips then |
|
294 |
begin |
|
295 |
maxTurnSkips := stats.TurnSkips; |
|
296 |
maxTurnSkipsName := TeamName; |
|
297 |
end; |
|
298 |
if stats.TeamDamage > maxTeamDamage then |
|
299 |
begin |
|
300 |
maxTeamDamage := stats.TeamDamage; |
|
301 |
maxTeamDamageName := TeamName; |
|
302 |
end; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
303 |
|
9405 | 304 |
end; |
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
305 |
|
9405 | 306 |
{ now send player stats for loser teams } |
307 |
for t:= 0 to Pred(TeamsCount) do |
|
308 |
begin |
|
309 |
with TeamsArray[t]^ do |
|
310 |
begin |
|
311 |
if Clan^.ClanHealth = 0 then |
|
312 |
begin |
|
313 |
SendStat(siPlayerKills, IntToStr(Clan^.Color) + ' ' + |
|
314 |
IntToStr(stats.Kills) + ' ' + TeamName); |
|
315 |
end; |
|
316 |
end; |
|
317 |
end; |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
318 |
|
9405 | 319 |
if msdhh <> nil then |
320 |
SendStat(siMaxStepDamage, IntToStr(msd) + ' ' + msdhh^.Name + ' (' + msdhh^.Team^.TeamName + ')'); |
|
321 |
if mskcnt = 1 then |
|
322 |
SendStat(siMaxStepKills, IntToStr(msk) + ' ' + mskhh^.Name + ' (' + mskhh^.Team^.TeamName + ')'); |
|
869 | 323 |
|
9405 | 324 |
if maxTeamKills > 1 then |
325 |
SendStat(siMaxTeamKills, IntToStr(maxTeamKills) + ' ' + maxTeamKillsName); |
|
326 |
if maxTurnSkips > 2 then |
|
327 |
SendStat(siMaxTurnSkips, IntToStr(maxTurnSkips) + ' ' + maxTurnSkipsName); |
|
328 |
if maxTeamDamage > 30 then |
|
329 |
SendStat(siMaxTeamDamage, IntToStr(maxTeamDamage) + ' ' + maxTeamDamageName); |
|
3784
75aa91bea32b
Extend statistics collection (TeamKills, TurnSkips, TeamDamage)
burp
parents:
3770
diff
changeset
|
330 |
|
9405 | 331 |
if KilledHHs > 0 then |
332 |
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
|
333 |
|
9405 | 334 |
// now to console |
10015 | 335 |
if winnersClan <> nil then |
9405 | 336 |
begin |
337 |
WriteLnToConsole('WINNERS'); |
|
9397 | 338 |
WriteLnToConsole(inttostr(winnersClan^.TeamsNumber)); |
9405 | 339 |
for t:= 0 to winnersClan^.TeamsNumber - 1 do |
340 |
WriteLnToConsole(winnersClan^.Teams[t]^.TeamName); |
|
341 |
end |
|
342 |
else |
|
343 |
WriteLnToConsole('DRAW'); |
|
10015 | 344 |
|
9397 | 345 |
ScriptCall('onAchievementsDeclaration'); |
346 |
end; |
|
6014 | 347 |
|
9409 | 348 |
procedure declareAchievement(id, teamname, location: shortstring; value: LongInt); |
10015 | 349 |
begin |
9411
d95ac9992529
Fix script flaw in detection of best team when sending achievement info
unc0rr
parents:
9409
diff
changeset
|
350 |
if (length(id) = 0) or (length(teamname) = 0) or (length(location) = 0) then exit; |
9397 | 351 |
WriteLnToConsole('ACHIEVEMENT'); |
352 |
WriteLnToConsole(id); |
|
353 |
WriteLnToConsole(teamname); |
|
9409 | 354 |
WriteLnToConsole(location); |
9397 | 355 |
WriteLnToConsole(inttostr(value)); |
814
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
356 |
end; |
7fb4417b7bc1
Start implementing better statistics implementation (does nothing yet)
unc0rr
parents:
diff
changeset
|
357 |
|
11574 | 358 |
procedure startGhostPoints(n: LongInt); |
359 |
begin |
|
360 |
WriteLnToConsole('GHOST_POINTS'); |
|
361 |
WriteLnToConsole(inttostr(n)); |
|
362 |
end; |
|
363 |
||
364 |
procedure dumpPoint(x, y: LongInt); |
|
365 |
begin |
|
366 |
WriteLnToConsole(inttostr(x)); |
|
367 |
WriteLnToConsole(inttostr(y)); |
|
368 |
end; |
|
369 |
||
3038 | 370 |
procedure initModule; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
371 |
begin |
11574 | 372 |
DamageClan := 0; |
373 |
DamageTotal := 0; |
|
374 |
DamageTurn := 0; |
|
12181
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
375 |
PoisonClan := 0; |
29f1ea94488b
Fix enemy saying “Missed” when poisoned w/o damage
Wuzzy <almikes@aol.com>
parents:
12162
diff
changeset
|
376 |
PoisonTurn := 0; |
11574 | 377 |
KillsClan := 0; |
378 |
Kills := 0; |
|
379 |
KillsTotal := 0; |
|
380 |
AmmoUsedCount := 0; |
|
381 |
AmmoDamagingUsed := false; |
|
382 |
SkippedTurns:= 0; |
|
383 |
isTurnSkipped:= false; |
|
384 |
vpHurtSameClan:= nil; |
|
385 |
vpHurtEnemy:= nil; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
386 |
TotalRounds:= -1; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2782
diff
changeset
|
387 |
FinishedTurnsTotal:= -1; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
388 |
end; |
3697 | 389 |
|
3038 | 390 |
procedure freeModule; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
391 |
begin |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
392 |
end; |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2712
diff
changeset
|
393 |
|
2619 | 394 |
end. |