aoe2_probe/prebuilt/config/
condition.rs

1use lazy_static::lazy_static;
2use linked_hash_map::LinkedHashMap;
3
4#[derive(Clone)]
5pub struct ConditionConfig {
6    pub name: &'static str,
7    pub attrs: Vec<&'static str>,
8}
9
10impl ConditionConfig {
11    fn new(name: &'static str, attrs: Vec<&'static str>) -> Self {
12        ConditionConfig { name, attrs }
13    }
14}
15
16lazy_static! {
17    pub static ref CONDITION_SCHEME: LinkedHashMap<i32, ConditionConfig> = {
18        let mut mapping = LinkedHashMap::new();
19
20        mapping.insert(0, ConditionConfig::new("None", vec![]));
21        mapping.insert(
22            1,
23            ConditionConfig::new(
24                "BRING_OBJECT_TO_AREA",
25                vec![
26                    "unit_object",
27                    "area_x1",
28                    "area_y1",
29                    "area_x2",
30                    "area_y2",
31                    "inverted",
32                ],
33            ),
34        );
35        mapping.insert(
36            2,
37            ConditionConfig::new(
38                "BRING_OBJECT_TO_OBJECT",
39                vec!["unit_object", "next_object", "inverted"],
40            ),
41        );
42        mapping.insert(
43            3,
44            ConditionConfig::new(
45                "OWN_OBJECTS",
46                vec![
47                    "quantity",
48                    "object_list",
49                    "source_player",
50                    "object_group",
51                    "object_type",
52                    "include_changeable_weapon_objects",
53                ],
54            ),
55        );
56        mapping.insert(
57            4,
58            ConditionConfig::new(
59                "OWN_FEWER_OBJECTS",
60                vec![
61                    "quantity",
62                    "object_list",
63                    "source_player",
64                    "area_x1",
65                    "area_y1",
66                    "area_x2",
67                    "area_y2",
68                    "object_group",
69                    "object_type",
70                    "include_changeable_weapon_objects",
71                ],
72            ),
73        );
74        mapping.insert(
75            5,
76            ConditionConfig::new(
77                "OBJECTS_IN_AREA",
78                vec![
79                    "quantity",
80                    "object_list",
81                    "source_player",
82                    "area_x1",
83                    "area_y1",
84                    "area_x2",
85                    "area_y2",
86                    "object_group",
87                    "object_type",
88                    "object_state",
89                    "inverted",
90                    "include_changeable_weapon_objects",
91                ],
92            ),
93        );
94        mapping.insert(
95            6,
96            ConditionConfig::new("DESTROY_OBJECT", vec!["unit_object", "inverted"]),
97        );
98        mapping.insert(
99            7,
100            ConditionConfig::new(
101                "CAPTURE_OBJECT",
102                vec!["unit_object", "source_player", "inverted"],
103            ),
104        );
105        mapping.insert(
106            8,
107            ConditionConfig::new(
108                "ACCUMULATE_ATTRIBUTE",
109                vec!["quantity", "attribute", "source_player", "inverted"],
110            ),
111        );
112        mapping.insert(
113            9,
114            ConditionConfig::new(
115                "RESEARCH_TECHNOLOGY",
116                vec!["source_player", "technology", "inverted"],
117            ),
118        );
119
120        mapping.insert(10, ConditionConfig::new("TIMER", vec!["timer", "inverted"]));
121        mapping.insert(
122            11,
123            ConditionConfig::new("OBJECT_SELECTED", vec!["unit_object", "inverted"]),
124        );
125        mapping.insert(
126            12,
127            ConditionConfig::new("AI_SIGNAL", vec!["ai_signal", "inverted"]),
128        );
129        mapping.insert(
130            13,
131            ConditionConfig::new("PLAYER_DEFEATED", vec!["source_player", "inverted"]),
132        );
133        mapping.insert(
134            14,
135            ConditionConfig::new(
136                "OBJECT_HAS_TARGET",
137                vec![
138                    "unit_object",
139                    "next_object",
140                    "object_list",
141                    "object_group",
142                    "object_type",
143                    "inverted",
144                ],
145            ),
146        );
147        mapping.insert(
148            15,
149            ConditionConfig::new("OBJECT_VISIBLE", vec!["unit_object"]),
150        );
151        mapping.insert(
152            16,
153            ConditionConfig::new("OBJECT_NOT_VISIBLE", vec!["unit_object"]),
154        );
155        mapping.insert(
156            17,
157            ConditionConfig::new(
158                "RESEARCHING_TECH",
159                vec!["source_player", "technology", "inverted"],
160            ),
161        );
162        mapping.insert(
163            18,
164            ConditionConfig::new(
165                "UNITS_GARRISONED",
166                vec!["quantity", "unit_object", "inverted"],
167            ),
168        );
169        mapping.insert(
170            19,
171            ConditionConfig::new(
172                "DIFFICULTY_LEVEL",
173                vec!["condition_type", "quantity", "inverted"],
174            ),
175        );
176
177        mapping.insert(20, ConditionConfig::new("CHANCE", vec!["quantity"]));
178        mapping.insert(
179            21,
180            ConditionConfig::new(
181                "TECHNOLOGY_STATE",
182                vec!["quantity", "source_player", "technology", "inverted"],
183            ),
184        );
185        mapping.insert(
186            22,
187            ConditionConfig::new(
188                "VARIABLE_VALUE",
189                vec!["quantity", "inverted", "variable", "comparison"],
190            ),
191        );
192        mapping.insert(
193            23,
194            ConditionConfig::new(
195                "OBJECT_HP",
196                vec!["quantity", "unit_object", "inverted", "comparison"],
197            ),
198        );
199        mapping.insert(
200            24,
201            ConditionConfig::new(
202                "DIPLOMACY_STATE",
203                vec!["quantity", "source_player", "inverted", "target_player"],
204            ),
205        );
206        mapping.insert(25, ConditionConfig::new("SCRIPT_CALL", vec!["xs_function"]));
207        mapping.insert(
208            26,
209            ConditionConfig::new(
210                "OBJECT_SELECTED_MULTIPLAYER",
211                vec!["unit_object", "source_player", "inverted"],
212            ),
213        );
214        mapping.insert(
215            27,
216            ConditionConfig::new(
217                "OBJECT_VISIBLE_MULTIPLAYER",
218                vec!["unit_object", "source_player", "inverted"],
219            ),
220        );
221        mapping.insert(
222            28,
223            ConditionConfig::new(
224                "OBJECT_HAS_ACTION",
225                vec!["unit_object", "next_object", "inverted", "unit_ai_action"],
226            ),
227        );
228        mapping.insert(29, ConditionConfig::new("OR", vec![]));
229
230        mapping.insert(
231            30,
232            ConditionConfig::new("AI_SIGNAL_MULTIPLAYER", vec!["ai_signal", "inverted"]),
233        );
234        mapping.insert(
235            54,
236            ConditionConfig::new("BUILDING_IS_TRADING", vec!["unit_object", "inverted"]),
237        );
238        mapping.insert(
239            55,
240            ConditionConfig::new("DISPLAY_TIMER_TRIGGERED", vec!["timer_id", "inverted"]),
241        );
242        mapping.insert(
243            56,
244            ConditionConfig::new(
245                "VICTORY_TIMER",
246                vec![
247                    "quantity",
248                    "source_player",
249                    "inverted",
250                    "comparison",
251                    "victory_timer_type",
252                ],
253            ),
254        );
255        mapping.insert(57, ConditionConfig::new("AND", vec![]));
256
257        mapping
258    };
259}