/
endgame_graphs.lua
454 lines (383 loc) · 19.8 KB
/
endgame_graphs.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
if not gadgetHandler:IsSyncedCode() then
return
end
function gadget:GetInfo()
return {
name = "Endgame Graphs",
desc = "Gathers misc stats",
author = "Sprung",
date = "2016-02-14",
license = "PD",
layer = 999999,
enabled = true,
}
end
local unitCategoryDefs = VFS.Include("LuaRules/Configs/unit_category.lua")
local teamList = Spring.GetTeamList()
local gaiaTeamID = Spring.GetGaiaTeamID()
local allyTeamByTeam
local spAreTeamsAllied = Spring.AreTeamsAllied
local spGetUnitHealth = Spring.GetUnitHealth
local spGetTeamResources = Spring.GetTeamResources
local spGetTeamRulesParam = Spring.GetTeamRulesParam
local spSetTeamRulesParam = Spring.SetTeamRulesParam
local spGetUnitRulesParam = Spring.GetUnitRulesParam
local GetUnitCost = Spring.Utilities.GetUnitCost
local SetHiddenTeamRulesParam = Spring.Utilities.SetHiddenTeamRulesParam
local GetHiddenTeamRulesParam = Spring.Utilities.GetHiddenTeamRulesParam
local reclaimListByTeam = {}
local metalExcessByTeam = {}
local damageReceivedByTeam = {}
local unitValueByTeam = {}
local unitCategoryValueByTeam = {}
local unitValueLostByTeam = {}
local totalNanoValueByTeam = {}
local partialNanoValueByTeam = {}
-- hax disregards LoS. Mostly for gadget use (eg awards), users can see it only after game over. Mid-game they can only see nonhax.
local damageDealtByTeamHax = {}
local damageDealtByTeamNonhax = {}
local unitValueKilledByTeamHax = {}
local unitValueKilledByTeamNonhax = {}
local ALLIED_VISIBLE = {allied = true}
local spGetUnitPosition = Spring.GetUnitPosition
local spIsPosInLos = Spring.IsPosInLos
local function canTeamSeeUnit(teamID, unitID)
local x, y, z = spGetUnitPosition(unitID)
local allyTeamID = allyTeamByTeam[teamID]
return spIsPosInLos(x, y, z, allyTeamID)
end
local dontCountUnits = {}
for unitDefID = 1, #UnitDefs do
if UnitDefs[unitDefID].customParams.dontcount or UnitDefs[unitDefID].customParams.is_drone then
dontCountUnits[unitDefID] = true
end
end
local featureMetal = {}
for i = 1, #FeatureDefs do
local featureDef = FeatureDefs[i]
featureMetal[i] = featureDef.metal
end
function gadget:AllowFeatureBuildStep(builderID, builderTeam, featureID, featureDefID, part)
if (part < 0) then
reclaimListByTeam[builderTeam] = reclaimListByTeam[builderTeam] + (part * featureMetal[featureDefID])
end
return true
end
function gadget:UnitDamaged(unitID, unitDefID, unitTeam, damage, paralyzer, weaponID, attackerID, attackerDefID, attackerTeam)
if paralyzer then return end
local hp, maxHP = spGetUnitHealth(unitID)
if (hp < 0) then
damage = damage + hp
end
local costdamage = (damage / maxHP) * GetUnitCost(unitID, unitDefID)
if attackerTeam and not spAreTeamsAllied(attackerTeam, unitTeam) then
damageDealtByTeamHax[attackerTeam] = damageDealtByTeamHax[attackerTeam] + costdamage
if canTeamSeeUnit(attackerTeam, unitID) then
damageDealtByTeamNonhax[attackerTeam] = damageDealtByTeamNonhax[attackerTeam] + costdamage
end
end
damageReceivedByTeam[unitTeam] = damageReceivedByTeam[unitTeam] + costdamage
end
local nanoframeCount = 0
local nanoframes = {} -- [index] = unitID
local nanoframeTeams = {} -- [index] = teamID
local nanoframeCosts = {} -- [index] = fullCost
local nanoframesByID = {} -- [unitID] = index
function gadget:UnitCreated(unitID, unitDefID, teamID)
if dontCountUnits[unitDefID] then
return
end
local cost = GetUnitCost(unitID, unitDefID)
nanoframeCount = nanoframeCount + 1
nanoframeTeams[nanoframeCount] = teamID
nanoframeCosts[nanoframeCount] = cost
nanoframes[nanoframeCount] = unitID
nanoframesByID[unitID] = nanoframeCount
totalNanoValueByTeam[teamID] = totalNanoValueByTeam[teamID] + cost
end
function gadget:UnitFinished(unitID, unitDefID, teamID)
if dontCountUnits[unitDefID] or spGetUnitRulesParam(unitID, "dangerous") then
return
end
local index = nanoframesByID[unitID]
local lastUnitID = nanoframes[nanoframeCount]
local cost = nanoframeCosts[index]
nanoframesByID[lastUnitID] = index
nanoframesByID[unitID] = nil
nanoframeTeams[index] = nanoframeTeams[nanoframeCount]
nanoframeCosts[index] = nanoframeCosts[nanoframeCount]
nanoframes[index] = lastUnitID
nanoframeCount = nanoframeCount - 1
unitValueByTeam[teamID] = unitValueByTeam[teamID] + cost
totalNanoValueByTeam[teamID] = totalNanoValueByTeam[teamID] - cost
local cat = unitCategoryDefs[unitDefID]
if cat and unitCategoryValueByTeam[teamID][cat] then
unitCategoryValueByTeam[teamID][cat] = unitCategoryValueByTeam[teamID][cat] + cost
end
end
function gadget:UnitReverseBuilt(unitID, unitDefID, teamID)
if dontCountUnits[unitDefID] or spGetUnitRulesParam(unitID, "dangerous") then
return
end
local cost = GetUnitCost(unitID, unitDefID)
nanoframeCount = nanoframeCount + 1
nanoframeTeams[nanoframeCount] = teamID
nanoframeCosts[nanoframeCount] = cost
nanoframes[nanoframeCount] = unitID
nanoframesByID[unitID] = nanoframeCount
totalNanoValueByTeam[teamID] = totalNanoValueByTeam[teamID] + cost
unitValueByTeam[teamID] = unitValueByTeam[teamID] - cost
local cat = unitCategoryDefs[unitDefID]
if cat and unitCategoryValueByTeam[teamID][cat] then
unitCategoryValueByTeam[teamID][cat] = unitCategoryValueByTeam[teamID][cat] - cost
end
end
function gadget:UnitDestroyed(unitID, unitDefID, teamID, attackerID, attackerDefID, attackerTeam)
if dontCountUnits[unitDefID] then
return
end
local index = nanoframesByID[unitID]
local cost
if index then
cost = nanoframeCosts[index]
local lastUnitID = nanoframes[nanoframeCount]
nanoframesByID[unitID] = nil
nanoframesByID[lastUnitID] = index
nanoframeTeams[index] = nanoframeTeams[nanoframeCount]
nanoframeCosts[index] = nanoframeCosts[nanoframeCount]
nanoframes[index] = nanoframes[nanoframeCount]
nanoframeCount = nanoframeCount - 1
totalNanoValueByTeam[teamID] = totalNanoValueByTeam[teamID] - cost
local buildProgress = select(5, spGetUnitHealth(unitID))
cost = cost * buildProgress
else
cost = GetUnitCost(unitID, unitDefID)
unitValueByTeam[teamID] = unitValueByTeam[teamID] - cost
local cat = unitCategoryDefs[unitDefID]
if cat and unitCategoryValueByTeam[teamID][cat] then
unitCategoryValueByTeam[teamID][cat] = unitCategoryValueByTeam[teamID][cat] - cost
end
end
local morphed = Spring.GetUnitRulesParam(unitID, "wasMorphedTo")
if morphed then
return
end
unitValueLostByTeam [teamID] = unitValueLostByTeam [teamID] + cost
if attackerTeam and not spAreTeamsAllied(attackerTeam, teamID) then
unitValueKilledByTeamHax[attackerTeam] = unitValueKilledByTeamHax[attackerTeam] + cost
if canTeamSeeUnit(attackerTeam, unitID) then
unitValueKilledByTeamNonhax[attackerTeam] = unitValueKilledByTeamNonhax[attackerTeam] + cost
end
end
end
function gadget:UnitTaken(unitID, unitDefID, oldTeam, newTeam)
if dontCountUnits[unitDefID] then
return
end
local index = nanoframesByID[unitID]
if index then
local cost = nanoframeCosts[index]
nanoframeTeams[index] = newTeam
totalNanoValueByTeam[oldTeam] = totalNanoValueByTeam[oldTeam] - cost
totalNanoValueByTeam[newTeam] = totalNanoValueByTeam[newTeam] + cost
else
local cost = GetUnitCost(unitID, unitDefID)
unitValueByTeam[oldTeam] = unitValueByTeam[oldTeam] - cost
unitValueByTeam[newTeam] = unitValueByTeam[newTeam] + cost
local cat = unitCategoryDefs[unitDefID]
if cat and unitCategoryValueByTeam[oldTeam][cat] and unitCategoryValueByTeam[newTeam][cat] then
unitCategoryValueByTeam[oldTeam][cat] = unitCategoryValueByTeam[oldTeam][cat] - cost
unitCategoryValueByTeam[newTeam][cat] = unitCategoryValueByTeam[newTeam][cat] + cost
end
end
end
local function RegenerateNanoframeValues()
for i = 1, #teamList do
local teamID = teamList[i]
partialNanoValueByTeam[teamID] = 0
end
for i = 1, nanoframeCount do
local unitID = nanoframes[i]
local teamID = nanoframeTeams[i]
local fullCost = nanoframeCosts[i]
local buildProgress = select(5, spGetUnitHealth(unitID))
if buildProgress then
local cost = fullCost * buildProgress
partialNanoValueByTeam[teamID] = partialNanoValueByTeam[teamID] + cost
end
end
end
local max = math.max
local function GetEnergyIncome (teamID)
local _, _, _, e = spGetTeamResources(teamID, "energy")
return (e or 0) +
(spGetTeamRulesParam(teamID, "OD_energyIncome") or 0) -
max(0, (spGetTeamRulesParam(teamID, "OD_energyChange") or 0))
end
local function GetMetalIncome (teamID)
local _, _, _, m = spGetTeamResources(teamID, "metal")
return m or 0
end
local stats_index
local sum_count
local mIncome = {}
local eIncome = {}
local mIncomeBase = {}
local mIncomeOverdrive = {}
local mTotalOverdrive = {}
function gadget:GameFrame(n)
if (n % 30) ~= 0 then
return
end
sum_count = sum_count + 1
local isSpringStatsHistoryFrame = ((n % 450) == 0)
RegenerateNanoframeValues()
for i = 1, #teamList do
local teamID = teamList[i]
mIncome[teamID] = mIncome[teamID] + GetMetalIncome (teamID)
eIncome[teamID] = eIncome[teamID] + GetEnergyIncome (teamID)
mIncomeBase [teamID] = mIncomeBase [teamID] + (spGetTeamRulesParam(teamID, "OD_metalBase" ) or 0)
local overdrive = (spGetTeamRulesParam(teamID, "OD_metalOverdrive") or 0)
if overdrive > 0 then
GG.Awards.AddAwardPoints('economist', teamID, overdrive)
end
mIncomeOverdrive[teamID] = mIncomeOverdrive[teamID] + overdrive
mTotalOverdrive[teamID] = mTotalOverdrive[teamID] + overdrive
SetHiddenTeamRulesParam(teamID, "stats_history_damage_dealt_current", damageDealtByTeamHax[teamID])
SetHiddenTeamRulesParam(teamID, "stats_history_unit_value_killed_current", unitValueKilledByTeamHax[teamID])
spSetTeamRulesParam(teamID, "stats_history_damage_dealt_current", damageDealtByTeamNonhax[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_damage_received_current", damageReceivedByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_overdrive_current", mTotalOverdrive[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_reclaim_current", -reclaimListByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_excess_current", metalExcessByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_current", unitValueByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_army_current", unitCategoryValueByTeam[teamID].army, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_def_current", unitCategoryValueByTeam[teamID].def, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_econ_current", unitCategoryValueByTeam[teamID].econ, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_other_current", unitCategoryValueByTeam[teamID].other, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_killed_current", unitValueKilledByTeamNonhax[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_lost_current", unitValueLostByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_nano_partial_current", partialNanoValueByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_nano_total_current", totalNanoValueByTeam[teamID], ALLIED_VISIBLE)
if isSpringStatsHistoryFrame then
SetHiddenTeamRulesParam(teamID, "stats_history_damage_dealt_" .. stats_index, damageDealtByTeamHax[teamID])
SetHiddenTeamRulesParam(teamID, "stats_history_unit_value_killed_" .. stats_index, unitValueKilledByTeamHax[teamID])
spSetTeamRulesParam(teamID, "stats_history_damage_dealt_" .. stats_index, damageDealtByTeamNonhax[teamID])
spSetTeamRulesParam(teamID, "stats_history_damage_received_" .. stats_index, damageReceivedByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_overdrive_" .. stats_index, mTotalOverdrive[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_reclaim_" .. stats_index, -reclaimListByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_excess_" .. stats_index, metalExcessByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_income_" .. stats_index, mIncome[teamID] / sum_count, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_income_base_" .. stats_index, mIncomeBase[teamID] / sum_count, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_income_od_" .. stats_index, mIncomeOverdrive[teamID] / sum_count, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_energy_income_" .. stats_index, eIncome[teamID] / sum_count, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_killed_" .. stats_index, unitValueKilledByTeamNonhax[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_lost_" .. stats_index, unitValueLostByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_" .. stats_index, unitValueByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_army_" .. stats_index, unitCategoryValueByTeam[teamID].army, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_def_" .. stats_index, unitCategoryValueByTeam[teamID].def, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_econ_" .. stats_index, unitCategoryValueByTeam[teamID].econ, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_other_" .. stats_index, unitCategoryValueByTeam[teamID].other, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_nano_partial_" .. stats_index, partialNanoValueByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_nano_total_" .. stats_index, totalNanoValueByTeam[teamID], ALLIED_VISIBLE)
mIncome [teamID] = 0
mIncomeBase [teamID] = 0
mIncomeOverdrive[teamID] = 0
eIncome [teamID] = 0
end
end
if isSpringStatsHistoryFrame then
sum_count = 0
stats_index = stats_index + 1
end
end
function gadget:GameOver()
gadget:GameFrame(450) -- fake history frame to snapshot end state
Spring.SetGameRulesParam("gameover_frame", Spring.GetGameFrame())
Spring.SetGameRulesParam("gameover_second", math.floor(Spring.GetGameSeconds()))
Spring.SetGameRulesParam("gameover_historyframe", stats_index - 1)
end
local externalFunctions = {}
function externalFunctions.AddTeamMetalExcess(teamID, metalExcess)
metalExcessByTeam[teamID] = metalExcessByTeam[teamID] + metalExcess
end
function gadget:Initialize()
stats_index = math.ceil(Spring.GetGameFrame() / 450) + 1
sum_count = 0
GG.EndgameGraphs = externalFunctions
for i = 1, #teamList do
local teamID = teamList[i]
unitValueByTeam[teamID] = 0
totalNanoValueByTeam[teamID] = 0
unitCategoryValueByTeam[teamID] = {
army = 0,
def = 0,
econ = 0,
other = 0,
}
end
local allUnits = Spring.GetAllUnits()
for i = 1, #allUnits do
local unitID = allUnits[i]
local unitDefID = Spring.GetUnitDefID(unitID)
local unitTeam = Spring.GetUnitTeam(unitID)
gadget:UnitCreated(unitID, unitDefID, unitTeam)
local isNanoframe = select(3, Spring.GetUnitIsStunned(unitID))
if not isNanoframe then
gadget:UnitFinished(unitID, unitDefID, unitTeam)
end
end
RegenerateNanoframeValues()
allyTeamByTeam = {}
for i = 1, #teamList do
local teamID = teamList[i]
allyTeamByTeam[teamID] = select(6, Spring.GetTeamInfo(teamID, false))
mIncome [teamID] = 0
mIncomeBase [teamID] = 0
mIncomeOverdrive[teamID] = 0
eIncome [teamID] = 0
spSetTeamRulesParam(teamID, "stats_history_metal_reclaim_current", spGetTeamRulesParam(teamID, "stats_history_metal_reclaim_current") or 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_excess_current", spGetTeamRulesParam(teamID, "stats_history_metal_excess_current") or 0, ALLIED_VISIBLE)
SetHiddenTeamRulesParam(teamID, "stats_history_damage_dealt_current", GetHiddenTeamRulesParam(teamID, "stats_history_damage_dealt_current") or 0)
SetHiddenTeamRulesParam(teamID, "stats_history_unit_value_killed_current", GetHiddenTeamRulesParam(teamID, "stats_history_unit_value_killed_current") or 0)
spSetTeamRulesParam(teamID, "stats_history_damage_dealt_current", spGetTeamRulesParam(teamID, "stats_history_damage_dealt_current") or 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_damage_received_current", spGetTeamRulesParam(teamID, "stats_history_damage_received_current") or 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_lost_current", spGetTeamRulesParam(teamID, "stats_history_unit_value_lost_current") or 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_killed_current", spGetTeamRulesParam(teamID, "stats_history_unit_value_killed_current") or 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_current", unitValueByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_army_current", unitCategoryValueByTeam[teamID].army, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_def_current", unitCategoryValueByTeam[teamID].def, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_econ_current", unitCategoryValueByTeam[teamID].econ, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_other_current", unitCategoryValueByTeam[teamID].other, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_nano_partial_current", partialNanoValueByTeam[teamID], ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_nano_total_current", totalNanoValueByTeam[teamID], ALLIED_VISIBLE)
SetHiddenTeamRulesParam (teamID, "stats_history_damage_dealt_0" , 0)
SetHiddenTeamRulesParam (teamID, "stats_history_unit_value_killed_0", 0)
spSetTeamRulesParam(teamID, "stats_history_damage_dealt_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_damage_received_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_reclaim_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_excess_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_income_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_income_base_0", 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_metal_income_od_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_energy_income_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_army_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_def_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_econ_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_other_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_killed_0", 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_unit_value_lost_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_nano_partial_0" , 0, ALLIED_VISIBLE)
spSetTeamRulesParam(teamID, "stats_history_nano_total_0" , 0, ALLIED_VISIBLE)
mTotalOverdrive [teamID] = spGetTeamRulesParam(teamID, "stats_history_metal_overdrive_current") or 0
reclaimListByTeam [teamID] = -spGetTeamRulesParam(teamID, "stats_history_metal_reclaim_current") or 0
metalExcessByTeam [teamID] = spGetTeamRulesParam(teamID, "stats_history_metal_excess_current") or 0
damageDealtByTeamHax[teamID] = GetHiddenTeamRulesParam(teamID, "stats_history_damage_dealt_current") or 0
damageDealtByTeamNonhax[teamID] = spGetTeamRulesParam(teamID, "stats_history_damage_dealt_current") or 0
unitValueKilledByTeamHax[teamID] = GetHiddenTeamRulesParam(teamID, "stats_history_unit_value_killed_current") or 0
unitValueKilledByTeamNonhax[teamID] = spGetTeamRulesParam(teamID, "stats_history_unit_value_killed_current") or 0
unitValueLostByTeam[teamID] = spGetTeamRulesParam(teamID, "stats_history_unit_value_lost_current") or 0
damageReceivedByTeam[teamID] = Spring.GetTeamRulesParam(teamID, "stats_history_damage_received_current") or 0
end
end