subtr_actor/stats/export/
core.rs1use crate::*;
2
3use super::*;
4
5impl StatFieldProvider for CorePlayerStats {
6 fn visit_stat_fields(&self, visitor: &mut dyn FnMut(ExportedStat)) {
7 visitor(ExportedStat::signed(
8 "core",
9 "score",
10 StatUnit::Count,
11 self.score,
12 ));
13 visitor(ExportedStat::signed(
14 "core",
15 "goals",
16 StatUnit::Count,
17 self.goals,
18 ));
19 visitor(ExportedStat::signed(
20 "core",
21 "assists",
22 StatUnit::Count,
23 self.assists,
24 ));
25 visitor(ExportedStat::signed(
26 "core",
27 "saves",
28 StatUnit::Count,
29 self.saves,
30 ));
31 visitor(ExportedStat::signed(
32 "core",
33 "shots",
34 StatUnit::Count,
35 self.shots,
36 ));
37 visitor(ExportedStat::unsigned(
38 "core",
39 "goals_conceded_while_last_defender",
40 StatUnit::Count,
41 self.goals_conceded_while_last_defender,
42 ));
43 visitor(ExportedStat::float(
44 "core",
45 "average_goal_time_after_kickoff",
46 StatUnit::Seconds,
47 self.average_goal_time_after_kickoff(),
48 ));
49 visitor(ExportedStat::float(
50 "core",
51 "median_goal_time_after_kickoff",
52 StatUnit::Seconds,
53 self.median_goal_time_after_kickoff(),
54 ));
55 visitor(ExportedStat::unsigned(
56 "core",
57 "kickoff_goal_count",
58 StatUnit::Count,
59 self.goal_after_kickoff.kickoff_goal_count,
60 ));
61 visitor(ExportedStat::unsigned(
62 "core",
63 "short_goal_count",
64 StatUnit::Count,
65 self.goal_after_kickoff.short_goal_count,
66 ));
67 visitor(ExportedStat::unsigned(
68 "core",
69 "medium_goal_count",
70 StatUnit::Count,
71 self.goal_after_kickoff.medium_goal_count,
72 ));
73 visitor(ExportedStat::unsigned(
74 "core",
75 "long_goal_count",
76 StatUnit::Count,
77 self.goal_after_kickoff.long_goal_count,
78 ));
79 visitor(ExportedStat::float(
80 "core",
81 "shooting_percentage",
82 StatUnit::Percent,
83 self.shooting_percentage(),
84 ));
85 visitor(ExportedStat::unsigned(
86 "core",
87 "counter_attack_goal_count",
88 StatUnit::Count,
89 self.goal_buildup.counter_attack_goal_count,
90 ));
91 visitor(ExportedStat::unsigned(
92 "core",
93 "sustained_pressure_goal_count",
94 StatUnit::Count,
95 self.goal_buildup.sustained_pressure_goal_count,
96 ));
97 visitor(ExportedStat::unsigned(
98 "core",
99 "other_buildup_goal_count",
100 StatUnit::Count,
101 self.goal_buildup.other_buildup_goal_count,
102 ));
103 }
104}
105
106impl StatFieldProvider for CoreTeamStats {
107 fn visit_stat_fields(&self, visitor: &mut dyn FnMut(ExportedStat)) {
108 visitor(ExportedStat::signed(
109 "core",
110 "score",
111 StatUnit::Count,
112 self.score,
113 ));
114 visitor(ExportedStat::signed(
115 "core",
116 "goals",
117 StatUnit::Count,
118 self.goals,
119 ));
120 visitor(ExportedStat::signed(
121 "core",
122 "assists",
123 StatUnit::Count,
124 self.assists,
125 ));
126 visitor(ExportedStat::signed(
127 "core",
128 "saves",
129 StatUnit::Count,
130 self.saves,
131 ));
132 visitor(ExportedStat::signed(
133 "core",
134 "shots",
135 StatUnit::Count,
136 self.shots,
137 ));
138 visitor(ExportedStat::float(
139 "core",
140 "average_goal_time_after_kickoff",
141 StatUnit::Seconds,
142 self.average_goal_time_after_kickoff(),
143 ));
144 visitor(ExportedStat::float(
145 "core",
146 "median_goal_time_after_kickoff",
147 StatUnit::Seconds,
148 self.median_goal_time_after_kickoff(),
149 ));
150 visitor(ExportedStat::unsigned(
151 "core",
152 "kickoff_goal_count",
153 StatUnit::Count,
154 self.goal_after_kickoff.kickoff_goal_count,
155 ));
156 visitor(ExportedStat::unsigned(
157 "core",
158 "short_goal_count",
159 StatUnit::Count,
160 self.goal_after_kickoff.short_goal_count,
161 ));
162 visitor(ExportedStat::unsigned(
163 "core",
164 "medium_goal_count",
165 StatUnit::Count,
166 self.goal_after_kickoff.medium_goal_count,
167 ));
168 visitor(ExportedStat::unsigned(
169 "core",
170 "long_goal_count",
171 StatUnit::Count,
172 self.goal_after_kickoff.long_goal_count,
173 ));
174 visitor(ExportedStat::float(
175 "core",
176 "shooting_percentage",
177 StatUnit::Percent,
178 self.shooting_percentage(),
179 ));
180 visitor(ExportedStat::unsigned(
181 "core",
182 "counter_attack_goal_count",
183 StatUnit::Count,
184 self.goal_buildup.counter_attack_goal_count,
185 ));
186 visitor(ExportedStat::unsigned(
187 "core",
188 "sustained_pressure_goal_count",
189 StatUnit::Count,
190 self.goal_buildup.sustained_pressure_goal_count,
191 ));
192 visitor(ExportedStat::unsigned(
193 "core",
194 "other_buildup_goal_count",
195 StatUnit::Count,
196 self.goal_buildup.other_buildup_goal_count,
197 ));
198 }
199}