Skip to main content

subtr_actor/stats/export/
core.rs

1use 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            "attacking_backboard_hit_count",
40            StatUnit::Count,
41            self.attacking_backboard_hit_count,
42        ));
43        visitor(ExportedStat::unsigned(
44            "core",
45            "double_tap_count",
46            StatUnit::Count,
47            self.double_tap_count,
48        ));
49        visitor(ExportedStat::unsigned(
50            "core",
51            "goals_conceded_while_last_defender",
52            StatUnit::Count,
53            self.goals_conceded_while_last_defender,
54        ));
55        visitor(ExportedStat::float(
56            "core",
57            "average_goal_time_after_kickoff",
58            StatUnit::Seconds,
59            self.average_goal_time_after_kickoff(),
60        ));
61        visitor(ExportedStat::float(
62            "core",
63            "median_goal_time_after_kickoff",
64            StatUnit::Seconds,
65            self.median_goal_time_after_kickoff(),
66        ));
67        visitor(ExportedStat::unsigned(
68            "core",
69            "kickoff_goal_count",
70            StatUnit::Count,
71            self.goal_after_kickoff.kickoff_goal_count,
72        ));
73        visitor(ExportedStat::unsigned(
74            "core",
75            "short_goal_count",
76            StatUnit::Count,
77            self.goal_after_kickoff.short_goal_count,
78        ));
79        visitor(ExportedStat::unsigned(
80            "core",
81            "medium_goal_count",
82            StatUnit::Count,
83            self.goal_after_kickoff.medium_goal_count,
84        ));
85        visitor(ExportedStat::unsigned(
86            "core",
87            "long_goal_count",
88            StatUnit::Count,
89            self.goal_after_kickoff.long_goal_count,
90        ));
91        visitor(ExportedStat::float(
92            "core",
93            "shooting_percentage",
94            StatUnit::Percent,
95            self.shooting_percentage(),
96        ));
97        visitor(ExportedStat::unsigned(
98            "core",
99            "counter_attack_goal_count",
100            StatUnit::Count,
101            self.goal_buildup.counter_attack_goal_count,
102        ));
103        visitor(ExportedStat::unsigned(
104            "core",
105            "sustained_pressure_goal_count",
106            StatUnit::Count,
107            self.goal_buildup.sustained_pressure_goal_count,
108        ));
109        visitor(ExportedStat::unsigned(
110            "core",
111            "other_buildup_goal_count",
112            StatUnit::Count,
113            self.goal_buildup.other_buildup_goal_count,
114        ));
115    }
116}
117
118impl StatFieldProvider for CoreTeamStats {
119    fn visit_stat_fields(&self, visitor: &mut dyn FnMut(ExportedStat)) {
120        visitor(ExportedStat::signed(
121            "core",
122            "score",
123            StatUnit::Count,
124            self.score,
125        ));
126        visitor(ExportedStat::signed(
127            "core",
128            "goals",
129            StatUnit::Count,
130            self.goals,
131        ));
132        visitor(ExportedStat::signed(
133            "core",
134            "assists",
135            StatUnit::Count,
136            self.assists,
137        ));
138        visitor(ExportedStat::signed(
139            "core",
140            "saves",
141            StatUnit::Count,
142            self.saves,
143        ));
144        visitor(ExportedStat::signed(
145            "core",
146            "shots",
147            StatUnit::Count,
148            self.shots,
149        ));
150        visitor(ExportedStat::unsigned(
151            "core",
152            "attacking_backboard_hit_count",
153            StatUnit::Count,
154            self.attacking_backboard_hit_count,
155        ));
156        visitor(ExportedStat::unsigned(
157            "core",
158            "double_tap_count",
159            StatUnit::Count,
160            self.double_tap_count,
161        ));
162        visitor(ExportedStat::float(
163            "core",
164            "average_goal_time_after_kickoff",
165            StatUnit::Seconds,
166            self.average_goal_time_after_kickoff(),
167        ));
168        visitor(ExportedStat::float(
169            "core",
170            "median_goal_time_after_kickoff",
171            StatUnit::Seconds,
172            self.median_goal_time_after_kickoff(),
173        ));
174        visitor(ExportedStat::unsigned(
175            "core",
176            "kickoff_goal_count",
177            StatUnit::Count,
178            self.goal_after_kickoff.kickoff_goal_count,
179        ));
180        visitor(ExportedStat::unsigned(
181            "core",
182            "short_goal_count",
183            StatUnit::Count,
184            self.goal_after_kickoff.short_goal_count,
185        ));
186        visitor(ExportedStat::unsigned(
187            "core",
188            "medium_goal_count",
189            StatUnit::Count,
190            self.goal_after_kickoff.medium_goal_count,
191        ));
192        visitor(ExportedStat::unsigned(
193            "core",
194            "long_goal_count",
195            StatUnit::Count,
196            self.goal_after_kickoff.long_goal_count,
197        ));
198        visitor(ExportedStat::float(
199            "core",
200            "shooting_percentage",
201            StatUnit::Percent,
202            self.shooting_percentage(),
203        ));
204        visitor(ExportedStat::unsigned(
205            "core",
206            "counter_attack_goal_count",
207            StatUnit::Count,
208            self.goal_buildup.counter_attack_goal_count,
209        ));
210        visitor(ExportedStat::unsigned(
211            "core",
212            "sustained_pressure_goal_count",
213            StatUnit::Count,
214            self.goal_buildup.sustained_pressure_goal_count,
215        ));
216        visitor(ExportedStat::unsigned(
217            "core",
218            "other_buildup_goal_count",
219            StatUnit::Count,
220            self.goal_buildup.other_buildup_goal_count,
221        ));
222    }
223}