Skip to main content

tiger_lib/vic3/tables/
triggers.rs

1use std::sync::LazyLock;
2
3use crate::everything::Everything;
4use crate::helpers::TigerHashMap;
5use crate::item::Item;
6use crate::scopes::*;
7use crate::token::Token;
8use crate::trigger::Trigger;
9use crate::vic3::tables::misc::*;
10
11use Trigger::*;
12
13pub fn scope_trigger(name: &Token, _data: &Everything) -> Option<(Scopes, Trigger)> {
14    let name_lc = name.as_str().to_ascii_lowercase();
15    TRIGGER_MAP.get(&*name_lc).copied()
16}
17
18static TRIGGER_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Trigger)>> = LazyLock::new(|| {
19    let mut hash = TigerHashMap::default();
20    for (from, s, trigger) in TRIGGER.iter().copied() {
21        hash.insert(s, (from, trigger));
22    }
23    hash
24});
25
26/// LAST UPDATED VIC3 VERSION 1.12.2
27/// See `triggers.log` from the game data dumps
28/// A key ends with '(' if it is the version that takes a parenthesized argument in script.
29const TRIGGER: &[(Scopes, &str, Trigger)] = &[
30    (Scopes::None, "active_lens", UncheckedTodo), // no examples in vanilla
31    (Scopes::None, "active_lens_option", UncheckedTodo), // no examples in vanilla
32    // TODO: warn if this is in an any_ iterator and not at the end
33    (Scopes::all_but_none(), "add_to_temporary_list", Special),
34    (Scopes::Country, "additional_war_exhaustion", CompareValue),
35    (Scopes::Character, "age", CompareValue),
36    (Scopes::Country, "aggressive_diplomatic_plays_permitted", Boolean),
37    (Scopes::Ship, "ai_ship_value", CompareValue),
38    (Scopes::None, "all_false", Control),
39    (Scopes::None, "always", Boolean),
40    (Scopes::Amendment, "amendment_can_be_repealed", Boolean),
41    (Scopes::Law, "amendment_count", CompareValue),
42    (
43        Scopes::Character.union(Scopes::InterestGroup).union(Scopes::PoliticalMovement),
44        "amendment_stance",
45        Block(&[
46            ("amendment", Scope(Scopes::Amendment)),
47            ("value", CompareChoiceOrNumber(APPROVALS)),
48        ]),
49    ),
50    (Scopes::Country, "additional_war_exhaustion", CompareValue),
51    (Scopes::Country, "additional_war_exhaustion", CompareValue),
52    (Scopes::None, "and", Control),
53    (Scopes::None, "any_false", Control),
54    (Scopes::PoliticalLobby, "appeasement", CompareValue),
55    (Scopes::Country, "approaching_bureaucracy_shortage", Boolean),
56    (Scopes::State, "arable_land", CompareValue),
57    (Scopes::Country, "arable_land_country", CompareValue),
58    (Scopes::Ship, "armor", CompareValue),
59    (
60        Scopes::Country,
61        "army_mobilization_option_fraction",
62        Block(&[("target", Scope(Scopes::MobilizationOption)), ("value", CompareValue)]),
63    ),
64    (Scopes::Country, "army_power_projection", CompareValue),
65    (Scopes::Country, "army_reserves", Removed("1.6", "")),
66    (Scopes::None, "assert_if", Block(&[("limit", Control), ("?text", UncheckedValue)])),
67    (Scopes::None, "assert_read", UncheckedValue),
68    (Scopes::Country, "authority", CompareValue),
69    (Scopes::Country, "authority_usage", CompareValue),
70    (Scopes::State, "available_jobs", CompareValue),
71    (Scopes::Country, "average_country_infrastructure", CompareValue),
72    (Scopes::Country, "average_incorporated_country_infrastructure", CompareValue),
73    (
74        Scopes::Country,
75        "average_sol_for_culture",
76        Block(&[("target", Scope(Scopes::Culture)), ("value", CompareValue)]),
77    ),
78    (Scopes::Country, "average_sol_for_primary_cultures", CompareValue),
79    (
80        Scopes::Country,
81        "average_sol_for_religion",
82        Block(&[("target", Scope(Scopes::Religion)), ("value", CompareValue)]),
83    ),
84    (Scopes::Country, "average_sol_for_slaves", CompareValue),
85    (Scopes::Country, "battalion_manpower", Removed("1.6", "")),
86    (Scopes::Battle, "battle_side_pm_usage", Removed("1.6", "")),
87    (Scopes::Treaty.union(Scopes::TreatyOptions), "binds", Scope(Scopes::Country)),
88    (Scopes::State, "blockade_level", CompareValue),
89    (Scopes::Building, "building_has_goods_shortage", Boolean),
90    (Scopes::Country, "bureaucracy", CompareValue),
91    (Scopes::Country, "bureaucracy_usage", CompareValue),
92    (Scopes::None, "calc_true_if", Control),
93    (
94        Scopes::State,
95        "can_activate_production_method",
96        Block(&[
97            ("building_type", Item(Item::BuildingType)),
98            ("production_method", Item(Item::ProductionMethod)),
99        ]),
100    ),
101    (Scopes::Country, "can_add_wargoal_against", Removed("1.12", "no direct replacement")),
102    (
103        Scopes::Country,
104        "can_afford_diplomatic_action",
105        Block(&[("target", Scope(Scopes::Country)), ("type", Item(Item::DiplomaticAction))]),
106    ),
107    (Scopes::Character, "can_agitate", Scope(Scopes::Country)),
108    (Scopes::Law, "can_be_enacted", Boolean),
109    (
110        Scopes::Country,
111        "can_break_diplomatic_pact",
112        Block(&[
113            ("target", Scope(Scopes::Country)),
114            ("type", Item(Item::DiplomaticAction)),
115            ("?first_state", Scope(Scopes::State)),
116            ("?second_state", Scope(Scopes::State)),
117        ]),
118    ),
119    (Scopes::State, "can_construct_building", Item(Item::BuildingType)),
120    (
121        Scopes::Country,
122        "can_create_diplomatic_pact",
123        Block(&[
124            ("target", Scope(Scopes::Country)),
125            ("type", Item(Item::DiplomaticAction)),
126            ("?first_state", Scope(Scopes::State)),
127            ("?second_state", Scope(Scopes::State)),
128        ]),
129    ),
130    (Scopes::None, "can_create_treaty", Special),
131    (Scopes::Country, "can_decrease_autonomy", Boolean),
132    (
133        Scopes::Country,
134        "can_establish_any_export_route",
135        Removed("1.9", "replaced with world market system"),
136    ),
137    (
138        Scopes::Country,
139        "can_establish_any_import_route",
140        Removed("1.9", "replaced with world market system"),
141    ),
142    (Scopes::Country, "can_establish_company", Boolean),
143    (Scopes::Country, "can_form_nation", Item(Item::Country)),
144    (
145        Scopes::Country,
146        "can_have_as_subject",
147        Block(&[("who", Scope(Scopes::Country)), ("type", Item(Item::SubjectType))]),
148    ),
149    (Scopes::StrategicRegion, "can_have_declared_interest_here", Removed("1.13", "")),
150    (Scopes::Country, "can_have_political_movement", Removed("1.8", "")),
151    (Scopes::Country, "can_have_subjects", Boolean),
152    (Scopes::Country, "can_increase_autonomy", Boolean),
153    (Scopes::PowerBloc, "can_invite_any_country", Boolean),
154    (Scopes::Country, "can_leave_power_bloc", Boolean),
155    (Scopes::Country, "can_lobbies_target", Scope(Scopes::Country)),
156    (Scopes::Country, "can_own_autonomy_be_decreased", Boolean),
157    (Scopes::Company, "can_potentially_produce_prestige_goods", Item(Item::PrestigeGoods)),
158    (Scopes::Building, "can_queue_building_levels", CompareValue),
159    (Scopes::Country, "can_research", Item(Item::Technology)),
160    (
161        Scopes::Country,
162        "can_send_diplomatic_action",
163        Block(&[
164            ("target", Scope(Scopes::Country)),
165            ("type", Item(Item::DiplomaticAction)),
166            ("?first_state", Scope(Scopes::State)),
167            ("?second_state", Scope(Scopes::State)),
168        ]),
169    ),
170    (Scopes::None, "can_start_tutorial_lesson", Item(Item::TutorialLesson)),
171    (
172        Scopes::Country,
173        "can_take_on_scaled_debt",
174        Block(&[("who", Scope(Scopes::Country)), ("value", CompareValue)]),
175    ),
176    (Scopes::Country, "can_transfer_subject", Scope(Scopes::Country)),
177    (Scopes::Country, "can_trigger_event", Item(Item::Event)),
178    (Scopes::Building, "cash_reserves_available", CompareValue),
179    (Scopes::Building, "cash_reserves_ratio", CompareValue),
180    (
181        Scopes::Character,
182        "character_acceptance",
183        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
184    ),
185    (
186        Scopes::Character,
187        "character_is_discriminated",
188        Removed("1.8", "replaced with character_acceptance"),
189    ),
190    (Scopes::Character, "character_supports_political_movement", Boolean),
191    (
192        Scopes::Country
193            .union(Scopes::Province)
194            .union(Scopes::Market)
195            .union(Scopes::State)
196            .union(Scopes::StateRegion)
197            .union(Scopes::StrategicRegion)
198            .union(Scopes::Theater),
199        "check_area",
200        Block(&[
201            ("mode", Choice(&["adjacent"])),
202            (
203                "target",
204                Scope(
205                    Scopes::Country
206                        .union(Scopes::Province)
207                        .union(Scopes::Market)
208                        .union(Scopes::State)
209                        .union(Scopes::StateRegion)
210                        .union(Scopes::StrategicRegion)
211                        .union(Scopes::Theater),
212                ),
213            ),
214        ]),
215    ),
216    (Scopes::CivilWar, "civil_war_progress", CompareValue),
217    (Scopes::Character, "commander_is_available", Boolean),
218    (Scopes::Character, "commander_pm_usage", Removed("1.6", "")),
219    (Scopes::Character, "commander_rank", CompareValue),
220    (Scopes::Company, "company_employed_levels", CompareValue),
221    (Scopes::Company, "company_global_productivity_comparison", CompareValue),
222    (Scopes::Company, "company_has_building_type_monopoly", Scope(Scopes::BuildingType)),
223    (Scopes::Company, "company_has_monopoly", Boolean),
224    (Scopes::Company, "company_is_prosperous", Boolean),
225    (Scopes::Company, "company_owned_levels", CompareValue),
226    (Scopes::Company, "company_productivity", CompareValue),
227    (Scopes::Company, "company_prosperity", CompareValue),
228    (Scopes::Country, "construction_queue_duration", CompareValue),
229    (Scopes::Country, "construction_queue_government_duration", CompareValue),
230    (Scopes::Country, "construction_queue_num_queued_government_levels", CompareValue),
231    (Scopes::Country, "construction_queue_num_queued_levels", CompareValue),
232    (Scopes::Country, "construction_queue_num_queued_private_levels", CompareValue),
233    (Scopes::Country, "construction_queue_private_duration", CompareValue),
234    (Scopes::StateRegion, "contains_capital_of", ScopeOrItem(Scopes::Country, Item::Country)),
235    (Scopes::State, "controls_treaty_port_province", Boolean),
236    (Scopes::Character, "could_support_political_movement", Scope(Scopes::PoliticalMovement)),
237    (
238        Scopes::Country,
239        "country_army_unit_type_fraction",
240        Block(&[("target", Scope(Scopes::CombatUnitType)), ("value", CompareValue)]),
241    ),
242    (
243        Scopes::Country,
244        "country_average_cultural_acceptance",
245        Block(&[("target", Scope(Scopes::Culture)), ("value", CompareValue)]),
246    ),
247    (
248        Scopes::Country,
249        "country_average_culture_and_religion_pop_acceptance",
250        Block(&[
251            ("culture", Scope(Scopes::Culture)),
252            ("religion", Scope(Scopes::Religion)),
253            ("value", CompareValue),
254        ]),
255    ),
256    (
257        Scopes::Country,
258        "country_average_culture_pop_acceptance",
259        Block(&[("culture", Scope(Scopes::Culture)), ("value", CompareValue)]),
260    ),
261    (
262        Scopes::Country,
263        "country_average_religion_pop_acceptance",
264        Block(&[("religion", Scope(Scopes::Religion)), ("value", CompareValue)]),
265    ),
266    (
267        Scopes::Country,
268        "country_average_religious_acceptance",
269        Block(&[("target", Scope(Scopes::Religion)), ("value", CompareValue)]),
270    ),
271    (Scopes::Country, "country_can_have_mass_migration_to", Scope(Scopes::Country)), // undocumented
272    (Scopes::CountryDefinition, "country_definition_has_culture", Scope(Scopes::Culture)),
273    (Scopes::Country, "country_fervor_primary_culture", CompareValue),
274    (
275        Scopes::Country,
276        "country_has_building_group_levels",
277        Block(&[
278            ("type", ScopeOrItem(Scopes::BuildingGroup, Item::BuildingGroup)),
279            ("value", CompareValue),
280        ]),
281    ),
282    (Scopes::Country, "country_has_building_levels", CompareValue),
283    (
284        Scopes::Country,
285        "country_has_building_type_levels",
286        Block(&[("target", Scope(Scopes::BuildingType)), ("value", CompareValue)]),
287    ),
288    (Scopes::Country, "country_has_building_type_monopoly", Scope(Scopes::BuildingType)),
289    (Scopes::Country, "country_has_country_monopoly", Boolean),
290    (Scopes::MarketGoods, "country_has_local_shortage", Scope(Scopes::Country)),
291    (Scopes::Country, "country_has_primary_culture", Scope(Scopes::Culture)),
292    (Scopes::Country, "country_has_state_religion", Scope(Scopes::Religion)),
293    (Scopes::Country, "country_innovation", CompareValue),
294    (
295        Scopes::Country,
296        "country_navy_unit_type_fraction",
297        Removed("1.13", "replaced with `country_ship_type_fraction`"),
298    ),
299    (Scopes::Country, "country_or_subject_owns_entire_state_region", Item(Item::StateRegion)),
300    (Scopes::Building, "country_ownership_fraction", CompareValue),
301    (Scopes::Country, "country_pm_usage", Removed("1.6", "")),
302    (Scopes::Country, "country_rank", CompareValue),
303    (Scopes::Country, "country_ship_type_fraction", UncheckedTodo),
304    (
305        Scopes::Country,
306        "country_ship_type_fraction",
307        Block(&[("target", Scope(Scopes::ShipType)), ("value", CompareValue)]),
308    ),
309    (Scopes::Country, "country_tier", ItemOrCompareValue(Item::CountryTier)),
310    (Scopes::Country, "country_turmoil", CompareValue),
311    (Scopes::Ship, "crew", CompareValue),
312    (Scopes::Ship, "crew_percent", CompareValue),
313    (Scopes::Pop, "culture_accepted", Removed("1.8", "")),
314    (
315        Scopes::Country,
316        "cultural_acceptance_base",
317        Block(&[("target", Scope(Scopes::Culture)), ("value", CompareValue)]),
318    ),
319    (
320        Scopes::State,
321        "cultural_acceptance_delta",
322        Block(&[("target", Scope(Scopes::Culture)), ("value", CompareValue)]),
323    ),
324    (
325        Scopes::Culture,
326        "culture_can_have_mass_migration_to",
327        Removed("1.6", "replaced with culture_can_have_mass_migration_to_country"),
328    ),
329    (Scopes::Culture, "culture_can_have_mass_migration_to_country", Scope(Scopes::Country)),
330    (Scopes::Culture, "culture_current_fervor", CompareValue),
331    (Scopes::Culture, "culture_has_community_in_state", Scope(Scopes::State)),
332    (Scopes::Culture, "culture_has_national_awakening", Boolean),
333    (Scopes::Culture, "culture_is_discriminated_in", Removed("1.8", "")),
334    (Scopes::Culture, "culture_national_awakening_occurred", Boolean),
335    (
336        Scopes::Country,
337        "culture_percent_country",
338        Block(&[("target", Scope(Scopes::Culture)), ("value", CompareValue)]),
339    ),
340    (
341        Scopes::State,
342        "culture_percent_state",
343        Block(&[("target", Scope(Scopes::Culture)), ("value", CompareValue)]),
344    ),
345    (
346        Scopes::Culture,
347        "culture_secession_progress",
348        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
349    ),
350    (Scopes::Culture, "culture_target_fervor", CompareValue),
351    (Scopes::PowerBloc, "current_cohesion_number", CompareValue),
352    (Scopes::PowerBloc, "current_cohesion_percentage", CompareValue),
353    (Scopes::Country, "current_law_enactment_score", CompareValue),
354    (Scopes::BattleSide, "current_manpower", CompareValue),
355    (Scopes::None, "current_tooltip_depth", CompareValue),
356    (Scopes::None, "custom_description", Control),
357    (Scopes::None, "custom_tooltip", Special),
358    (Scopes::None, "day_value", CompareValue),
359    (Scopes::None, "daynight_value", CompareValue),
360    (Scopes::Ship, "days_obsolete", Removed("1.13.8", "")),
361    (Scopes::None, "debug_log", UncheckedTodo),
362    (Scopes::None, "debug_log_details", Boolean),
363    (Scopes::Pop, "dependents", CompareValue),
364    (Scopes::State, "devastation", CompareValue),
365    (Scopes::DiplomaticPlay, "diplomatic_play_pm_usage", Removed("1.6", "")),
366    (Scopes::Country, "discriminates_religion", ScopeOrItem(Scopes::Religion, Item::Religion)),
367    (Scopes::Building, "earnings", CompareValue),
368    (
369        Scopes::Country,
370        "economic_dependence",
371        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
372    ),
373    (Scopes::Party, "election_momentum", CompareValue),
374    (Scopes::Country, "electoral_confidence", CompareValue),
375    (Scopes::Country, "empty_agitator_slots", CompareValue),
376    (Scopes::Country, "enacting_any_law", Boolean),
377    (Scopes::Country, "enactment_chance", CompareValue),
378    (
379        Scopes::Country,
380        "enactment_chance_for_law",
381        Block(&[("target", Scope(Scopes::LawType)), ("value", CompareValue)]),
382    ),
383    (
384        Scopes::Country,
385        "enactment_chance_for_law_without_enactment_modifier",
386        Block(&[("target", Scope(Scopes::LawType)), ("value", CompareValue)]),
387    ),
388    (Scopes::Country, "enactment_chance_without_enactment_modifier", CompareValue),
389    (Scopes::Country, "enactment_phase", CompareValue),
390    (Scopes::Country, "enactment_setback_count", CompareValue),
391    (
392        Scopes::Country,
393        "enemy_contested_wargoals",
394        Block(&[("target", Scope(Scopes::War)), ("value", CompareValue)]),
395    ),
396    (Scopes::Country, "enemy_occupation", CompareValue),
397    (Scopes::None, "error_check", Removed("1.7", "")),
398    (Scopes::DiplomaticPlay, "escalation", CompareValue),
399    (Scopes::None, "exists", Special),
400    (
401        Scopes::Country,
402        "expanding_institution",
403        ScopeOrItem(Scopes::InstitutionType, Item::Institution),
404    ),
405    (Scopes::Character, "experience_level", CompareValue),
406    (Scopes::StateGoods, "export_advantage", CompareValue),
407    (Scopes::StateGoods, "export_tariff_level", CompareValue),
408    (Scopes::Country, "fixed_expenses", CompareValueWarnEq),
409    (Scopes::Country, "fixed_income", CompareValueWarnEq),
410    (Scopes::Country, "flotilla_manpower", Removed("1.6", "")),
411    (Scopes::Pop, "food_security", CompareValue),
412    (
413        Scopes::MilitaryFormation,
414        "formation_army_unit_type_fraction",
415        Block(&[("target", Scope(Scopes::CombatUnitType)), ("value", CompareValue)]),
416    ),
417    (
418        Scopes::MilitaryFormation,
419        "formation_navy_unit_type_fraction",
420        Removed("1.13", "replaced with `formation_ship_type_fraction`"),
421    ),
422    (
423        Scopes::MilitaryFormation,
424        "formation_ship_type_fraction",
425        Block(&[("target", Scope(Scopes::ShipType)), ("value", CompareValue)]),
426    ),
427    (
428        Scopes::Building,
429        "fraction_of_levels_owned_by_country",
430        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
431    ),
432    (Scopes::State, "free_arable_land", CompareValue),
433    (Scopes::PowerBloc, "free_principle_slots", CompareValue),
434    (Scopes::Front, "front_side_pm_usage", Removed("1.6", "")),
435    (Scopes::None, "game_date", CompareDate),
436    (
437        Scopes::Country,
438        "gdp_ownership_ratio",
439        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
440    ),
441    (Scopes::Country, "gdp_per_capita_ranking", CompareValue),
442    (Scopes::Country, "gdp_ranking", CompareValue),
443    (Scopes::None, "global_variable_map_size", UncheckedTodo),
444    (
445        Scopes::Country,
446        "goods_production_rank",
447        Block(&[("target", Scope(Scopes::Goods)), ("value", CompareValue)]),
448    ),
449    (Scopes::Country, "global_country_ranking", CompareValue),
450    (Scopes::None, "global_population", CompareValue),
451    (
452        Scopes::None,
453        "global_variable_list_size",
454        Block(&[("name", Identifier("list name")), ("value", CompareValue)]),
455    ),
456    (Scopes::Country, "gold_reserves", CompareValue),
457    (Scopes::Country, "gold_reserves_limit", CompareValue),
458    (Scopes::Country, "government_legitimacy", CompareValue),
459    (Scopes::Country, "government_transfer_of_power", Item(Item::TransferOfPower)),
460    (Scopes::Country, "government_wage_level", CompareChoice(LEVELS)),
461    (Scopes::Country, "government_wage_level_value", CompareValue),
462    (
463        Scopes::HarvestCondition,
464        "harvest_condition_intensity",
465        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
466    ),
467    (Scopes::None, "has_account_item", UncheckedValue),
468    (Scopes::Market.union(Scopes::State), "has_active_building", Item(Item::BuildingType)),
469    (Scopes::Country, "has_active_peace_deal", Boolean),
470    (Scopes::Building, "has_active_production_method", Item(Item::ProductionMethod)),
471    (Scopes::Law, "has_amendment", Scope(Scopes::AmendmentType)),
472    (Scopes::Country, "has_any_law_commitment", Boolean),
473    (Scopes::Country, "has_any_naval_only_hostilities", Boolean),
474    (Scopes::Country, "has_any_strait_control", Scope(Scopes::Country)),
475    (Scopes::Country, "has_any_strait_province", Scope(Scopes::Country)),
476    (Scopes::Country, "has_any_subventions_on", Scope(Scopes::Goods)),
477    (Scopes::Country, "has_any_secessionists_broken_out", Boolean),
478    (Scopes::Country, "has_any_secessionists_growing", Boolean),
479    (Scopes::Country, "has_any_secessionists_possible", Removed("1.8", "")),
480    (Scopes::Country, "has_any_tariffs_on", Scope(Scopes::Goods)),
481    (Scopes::State, "has_assimilating_pops", Boolean),
482    (
483        Scopes::Country,
484        "has_attitude",
485        Block(&[("who", Scope(Scopes::Country)), ("attitude", Item(Item::Attitude))]),
486    ),
487    (Scopes::BattleSide, "has_battle_condition", Item(Item::BattleCondition)),
488    (
489        Scopes::Country.union(Scopes::Market).union(Scopes::State).union(Scopes::StateRegion),
490        "has_building",
491        Item(Item::BuildingType),
492    ),
493    (Scopes::PoliticalMovement, "has_character_ideology", Item(Item::Ideology)),
494    (Scopes::Country, "has_civil_war_from_movement_type", Scope(Scopes::PoliticalMovementType)),
495    (
496        Scopes::Country,
497        "has_claim",
498        Scope(Scopes::State.union(Scopes::StateRegion).union(Scopes::Country)),
499    ),
500    (Scopes::State, "has_claim_by", Scope(Scopes::Country)),
501    (
502        Scopes::Character,
503        "has_commander_order",
504        ScopeOrItem(Scopes::CommanderOrderType, Item::CommanderOrder),
505    ),
506    (Scopes::Country, "has_company", ScopeOrItem(Scopes::CompanyType, Item::CompanyType)),
507    (Scopes::Country, "has_completed_subgoal", Item(Item::ObjectiveSubgoal)),
508    (Scopes::Country, "has_consumption_tax", Scope(Scopes::Goods)),
509    (Scopes::State, "has_converting_pops", Boolean),
510    (Scopes::Country, "has_convoys_being_sunk", Boolean),
511    (Scopes::PoliticalMovement, "has_core_ideology", Boolean),
512    (Scopes::None, "has_cosmetic_dlc", UncheckedTodo),
513    (Scopes::None, "has_cosmetic_dlc_feature", UncheckedTodo),
514    (Scopes::State, "has_cultural_community", Scope(Scopes::Culture)),
515    (Scopes::Culture, "has_cultural_obsession", Item(Item::Goods)),
516    (Scopes::Character, "has_culture", Scope(Scopes::Character.union(Scopes::Culture))),
517    (Scopes::Culture, "has_culture_graphics", Item(Item::CultureGraphics)),
518    (Scopes::Country, "has_decreasing_interests", Removed("1.13", "")),
519    (Scopes::State, "has_decree", Item(Item::Decree)),
520    (Scopes::Building, "has_deployed_units", Boolean),
521    // TODO: limit the type to diplomatic actions that have pacts
522    (
523        Scopes::Country,
524        "has_diplomatic_pact",
525        Block(&[
526            ("who", Scope(Scopes::Country)),
527            ("type", Item(Item::DiplomaticAction)),
528            ("?is_initiator", Boolean),
529        ]),
530    ),
531    (Scopes::StrategicRegion, "has_diplomatic_play", Boolean),
532    (Scopes::Country, "has_diplomatic_relevance", Scope(Scopes::Country)),
533    (Scopes::Country, "has_diplomats_expelled", Scope(Scopes::Country)),
534    (
535        Scopes::Culture.union(Scopes::Religion),
536        "has_discrimination_trait",
537        Item(Item::DiscriminationTrait),
538    ),
539    (
540        Scopes::Culture.union(Scopes::Religion),
541        "has_discrimination_trait_group",
542        Item(Item::DiscriminationTraitGroup),
543    ),
544    (Scopes::None, "has_dlc_feature", Item(Item::DlcFeature)),
545    (
546        Scopes::Building,
547        "has_employee_slots_filled",
548        Block(&[("pop_type", Item(Item::PopType)), ("percent", CompareValue)]),
549    ),
550    (
551        Scopes::Country,
552        "has_export_priority_tariffs",
553        Removed("1.9", "replaced with world market system"),
554    ),
555    (Scopes::Building, "has_failed_hires", Boolean),
556    (Scopes::Country.union(Scopes::State), "has_famine", Boolean),
557    (Scopes::Country, "has_free_government_reform", Boolean),
558    (Scopes::None, "has_game_rule", Item(Item::GameRuleSetting)),
559    (Scopes::None, "has_game_started", Boolean),
560    (Scopes::None, "has_gameplay_dlc", UncheckedTodo),
561    (Scopes::Country, "has_global_highest_gdp", Boolean),
562    (Scopes::Country, "has_global_highest_innovation", Boolean),
563    (Scopes::None, "has_global_variable", Identifier("variable name")),
564    (Scopes::None, "has_global_variable_list", Identifier("list name")),
565    (Scopes::None, "has_global_variable_map", UncheckedTodo),
566    (Scopes::Country, "has_government_clout", CompareValue),
567    (Scopes::Country, "has_government_type", Item(Item::GovernmentType)),
568    (Scopes::StateRegion, "has_harvest_condition", Item(Item::HarvestConditionType)),
569    (Scopes::Country, "has_healthy_economy", Boolean),
570    (Scopes::MilitaryFormation, "has_high_attrition", Boolean),
571    (Scopes::Culture, "has_homeland", Scope(Scopes::State.union(Scopes::StateRegion))),
572    (Scopes::PowerBloc, "has_identity", Scope(Scopes::PowerBlocIdentity)),
573    (
574        Scopes::Character.union(Scopes::InterestGroup).union(Scopes::PoliticalMovement),
575        "has_ideology",
576        ScopeOrItem(Scopes::Ideology, Item::Ideology),
577    ),
578    (
579        Scopes::Country,
580        "has_import_priority_tariffs",
581        Removed("1.9", "replaced with world market system"),
582    ),
583    (Scopes::Country, "has_inactive_journal_entry", Item(Item::JournalEntry)),
584    (Scopes::Country, "has_institution", ScopeOrItem(Scopes::InstitutionType, Item::Institution)),
585    (Scopes::Country, "has_insurrectionary_interest_groups", Boolean),
586    (
587        Scopes::Country,
588        "has_interest_marker_in_region",
589        ScopeOrItem(Scopes::StrategicRegion, Item::StrategicRegion),
590    ),
591    (Scopes::Country, "has_journal_entry", Item(Item::JournalEntry)),
592    (Scopes::Province, "has_label", Item(Item::TerrainLabel)),
593    (Scopes::Country, "has_law", Scope(Scopes::LawType)),
594    (Scopes::Country, "has_law_commitment", Scope(Scopes::LawType)),
595    (
596        Scopes::Country,
597        "has_law_imposition_rights",
598        Block(&[("target_country", Scope(Scopes::Country)), ("law_type", Scope(Scopes::LawType))]),
599    ),
600    (Scopes::Country, "has_law_or_variant", Scope(Scopes::LawType)),
601    (Scopes::None, "has_local_variable", Special),
602    (Scopes::None, "has_local_variable_list", Special),
603    (Scopes::None, "has_local_variable_map", UncheckedTodo),
604    (Scopes::None, "has_map_interaction", Item(Item::MapInteractionType)),
605    (Scopes::None, "has_map_interaction_diplomatic_action", Item(Item::DiplomaticAction)),
606    (
607        Scopes::None,
608        "has_map_interaction_export_goods",
609        Removed("1.9", "replaced with world market system"),
610    ),
611    (
612        Scopes::None,
613        "has_map_interaction_import_goods",
614        Removed("1.9", "replaced with world market system"),
615    ),
616    (Scopes::Character, "has_military_formation", Boolean),
617    (Scopes::MilitaryFormation, "has_mobilization_option", Scope(Scopes::MobilizationOption)),
618    (Scopes::State, "has_mobilizing_unit", Boolean),
619    (
620        Scopes::Country
621            .union(Scopes::Building)
622            .union(Scopes::Character)
623            .union(Scopes::Institution)
624            .union(Scopes::InterestGroup)
625            .union(Scopes::JournalEntry)
626            .union(Scopes::PoliticalMovement)
627            .union(Scopes::PowerBloc)
628            .union(Scopes::State),
629        "has_modifier",
630        Item(Item::Modifier),
631    ),
632    (Scopes::MilitaryFormation, "has_naval_mission_with_invalid_area", Boolean),
633    (Scopes::InterestGroup, "has_negotiated", Boolean),
634    (
635        Scopes::Country,
636        "has_no_priority_tariffs",
637        Removed("1.9", "replaced with world market system"),
638    ),
639    (Scopes::Country, "has_objective", Item(Item::Objective)),
640    (Scopes::Pop, "has_ongoing_assimilation", Boolean),
641    (Scopes::Pop, "has_ongoing_conversion", Boolean),
642    (Scopes::Country, "has_overlapping_interests", Scope(Scopes::Country)),
643    (Scopes::AmendmentType, "has_parent_law", Boolean),
644    (Scopes::InterestGroup, "has_party", Boolean),
645    (Scopes::Party, "has_party_member", Scope(Scopes::InterestGroup)),
646    (Scopes::DiplomaticPlay, "has_play_goal", Item(Item::WarGoalType)),
647    (Scopes::Country, "has_political_movement", Removed("1.8", "")),
648    (Scopes::Pop, "has_pop_culture", Item(Item::Culture)),
649    (Scopes::Pop, "has_pop_religion", Item(Item::Religion)),
650    (
651        Scopes::Country.union(Scopes::Market).union(Scopes::State),
652        "has_port",
653        Removed("1.13", "replaced with `has_port_market` and `has_port_state`"),
654    ),
655    (Scopes::Country, "has_port_country", Boolean),
656    (Scopes::Market, "has_port_market", Boolean),
657    (Scopes::State, "has_port_state", Boolean),
658    (Scopes::Country, "has_possible_decisions", Boolean),
659    (
660        Scopes::State,
661        "has_potential_resource",
662        ScopeOrItem(Scopes::BuildingType, Item::BuildingType),
663    ),
664    (Scopes::MarketGoods.union(Scopes::StateGoods), "has_potential_supply", Boolean),
665    (Scopes::Country, "has_potential_to_form_country", UncheckedTodo), // No examples in vanilla
666    (Scopes::Country, "has_power_struggle", Boolean),
667    (Scopes::PowerBloc, "has_principle", Scope(Scopes::PowerBlocPrinciple)),
668    (Scopes::PowerBloc, "has_principle_group", Scope(Scopes::PowerBlocPrincipleGroup)),
669    (Scopes::None, "has_reached_end_date", Boolean),
670    (
671        Scopes::Country,
672        "has_region_stance",
673        Block(&[
674            ("region", Scope(Scopes::StrategicRegion)),
675            ("stance", Item(Item::AiStrategicRegionStanceType)),
676        ]),
677    ),
678    (Scopes::Character, "has_religion", ScopeOrItem(Scopes::Religion, Item::Religion)),
679    (Scopes::Religion, "has_religious_taboo", Item(Item::Goods)),
680    (Scopes::Country, "has_researchable_technology", Boolean),
681    (Scopes::Country, "has_revolution", Boolean),
682    (Scopes::Country, "has_revolution_over_law_type", Removed("1.8", "")),
683    (Scopes::Character, "has_role", Item(Item::CharacterRole)),
684    (Scopes::Character, "has_role_of_type", Item(Item::CharacterArchetype)),
685    (Scopes::Country, "has_ruling_interest_group", Item(Item::InterestGroup)),
686    (Scopes::Country, "has_ruling_interest_group_count", CompareValue),
687    (
688        Scopes::Country,
689        "has_secret_goal",
690        Block(&[("who", Scope(Scopes::Country)), ("secret_goal", Item(Item::SecretGoal))]),
691    ),
692    (Scopes::MilitaryFormation, "has_ship_outside_max_port_distance", Boolean),
693    (Scopes::Pop, "has_social_class", Item(Item::SocialClass)),
694    (Scopes::Country, "has_social_hierarchy", Item(Item::SocialHierarchy)),
695    (Scopes::Country, "has_state_in_state_region", Item(Item::StateRegion)),
696    (Scopes::Pop, "has_state_religion", Boolean),
697    (Scopes::State, "has_state_trait", Item(Item::StateTrait)),
698    (Scopes::Country, "has_strategic_adjacency", Scope(Scopes::State.union(Scopes::Country))),
699    (Scopes::Country, "has_strategic_land_adjacency", Scope(Scopes::State.union(Scopes::Country))),
700    (
701        Scopes::Country,
702        "has_strategic_region_interest_tier",
703        Block(&[("strategic_region", Scope(Scopes::StrategicRegion)), ("value", CompareValue)]),
704    ),
705    (Scopes::Country, "has_strategy", Item(Item::AiStrategy)),
706    (Scopes::Country, "has_subject_relation_with", Scope(Scopes::Country)),
707    (Scopes::Country, "has_sufficient_construction_capacity_for_investment", Boolean),
708    // no examples in vanilla
709    (
710        Scopes::Country,
711        "has_technology_progress",
712        Block(&[("technology", UncheckedTodo), ("progress", CompareValue)]),
713    ),
714    (
715        Scopes::Country,
716        "has_technology_researched",
717        ScopeOrItem(Scopes::Technology, Item::Technology),
718    ),
719    (Scopes::Character, "has_template", Item(Item::CharacterTemplate)),
720    (Scopes::Province, "has_terrain", Item(Item::Terrain)),
721    (Scopes::Character, "has_trait", Item(Item::CharacterTrait)),
722    (
723        Scopes::Country,
724        "has_treaty_port_in_country",
725        Removed("1.9", "replaced with `has_treaty_port_in_market`"),
726    ),
727    (Scopes::Country, "has_treaty_port_in_market", Scope(Scopes::Market)),
728    (Scopes::Country, "has_truce_with", Scope(Scopes::Country)),
729    (
730        Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions),
731        "has_type",
732        Item(Item::TreatyArticle),
733    ),
734    (Scopes::None, "has_unification_candidate", UncheckedTodo), // No examples in vanilla
735    (Scopes::NewCombatUnit, "has_unit_type", Scope(Scopes::CombatUnitType)),
736    (Scopes::None, "has_variable", Identifier("variable name")),
737    (Scopes::None, "has_variable_list", Identifier("list name")),
738    (Scopes::None, "has_variable_map", UncheckedTodo),
739    (
740        Scopes::War,
741        "has_war_exhaustion",
742        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
743    ),
744    (Scopes::War, "has_war_goal", Item(Item::WarGoalType)),
745    (
746        Scopes::War,
747        "has_war_support",
748        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
749    ),
750    (Scopes::Country, "has_war_with", Scope(Scopes::Country)),
751    (Scopes::Country, "has_wasted_construction", Boolean),
752    (Scopes::None, "hidden_trigger", Control),
753    (
754        Scopes::Country,
755        "highest_overlapping_interest_tier",
756        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
757    ),
758    (Scopes::Country, "highest_secession_progress", CompareValue),
759    (Scopes::Ship, "hit_points", CompareValue),
760    (Scopes::Ship, "hit_points_percent", CompareValue),
761    (Scopes::InterestGroup, "ig_approval", CompareChoiceOrNumber(APPROVALS)),
762    (Scopes::InterestGroup, "ig_clout", CompareValue),
763    (Scopes::InterestGroup, "ig_government_power_share", CompareValue),
764    (
765        Scopes::State,
766        "ig_state_pol_strength_share",
767        Block(&[("target", Scope(Scopes::InterestGroup)), ("value", CompareValue)]),
768    ),
769    (Scopes::StateGoods, "import_advantage", CompareValue),
770    (Scopes::StateGoods, "import_tariff_level", CompareChoice(TARIFF_LEVELS)),
771    (Scopes::Country, "in_default", Boolean),
772    (Scopes::Country, "in_election_campaign", Boolean),
773    (Scopes::DiplomaticPact, "income_transfer", CompareValue),
774    (Scopes::State, "incorporation_progress", CompareValue),
775    (Scopes::Country, "influence", CompareValue),
776    (Scopes::Country, "influence_usage", CompareValue),
777    (Scopes::State.union(Scopes::StateRegion), "infrastructure", CompareValue),
778    (Scopes::State.union(Scopes::StateRegion), "infrastructure_delta", CompareValue),
779    (Scopes::State.union(Scopes::StateRegion), "infrastructure_usage", CompareValue),
780    (Scopes::DiplomaticPlay, "initiator_is", Scope(Scopes::Country)),
781    (
782        Scopes::Country,
783        "institution_investment_level",
784        Block(&[("institution", Item(Item::Institution)), ("value", CompareValue)]),
785    ),
786    (Scopes::InterestGroup, "interest_group_population", CompareValue),
787    (Scopes::InterestGroup, "interest_group_population_percentage", CompareValue),
788    (Scopes::InterestGroup, "interest_group_supports_political_movement", Boolean),
789    (Scopes::Invasion, "invasion_has_marines", Boolean),
790    (Scopes::Country, "investment_pool", CompareValue),
791    (Scopes::Country, "investment_pool_gross_income", CompareValue),
792    (Scopes::Country, "investment_pool_net_income", CompareValue),
793    (Scopes::None, "is_active", Removed("1.9", "")),
794    (
795        Scopes::Country,
796        "is_adjacent",
797        Removed("removed in 1.5", "replaced with is_adjacent_to_country and is_adjacent_to_state"),
798    ),
799    (Scopes::Country, "is_adjacent_to_country", Scope(Scopes::Country)),
800    (Scopes::Market, "is_adjacent_to_market", Scope(Scopes::Market)),
801    (Scopes::Country, "is_adjacent_to_state", Scope(Scopes::State)),
802    (Scopes::Character, "is_adult", Boolean),
803    (Scopes::Character, "is_advancing_on_front", Scope(Scopes::Front)),
804    (Scopes::Country, "is_ai", Boolean),
805    (Scopes::MilitaryFormation, "is_army", Boolean),
806    (Scopes::Country, "is_at_war", Boolean),
807    (Scopes::Character.union(Scopes::Ship), "is_attacker_in_battle", Boolean),
808    (Scopes::CharacterRole, "is_auto_assigned", Boolean),
809    (Scopes::Country, "is_banning_goods", ScopeOrItem(Scopes::Goods, Item::Goods)),
810    (Scopes::PoliticalMovement, "is_being_bolstered", Boolean),
811    (Scopes::State, "is_being_bombarded", Boolean),
812    (Scopes::PoliticalMovement, "is_being_suppressed", Boolean),
813    (Scopes::State, "is_blockaded_by", Scope(Scopes::Country)),
814    (Scopes::Building, "is_buildable", Boolean),
815    (Scopes::Building, "is_building_group", Item(Item::BuildingGroup)),
816    (Scopes::Building, "is_building_type", Item(Item::BuildingType)),
817    (
818        Scopes::None,
819        "is_building_type_expanded",
820        ScopeOrItem(Scopes::BuildingType, Item::BuildingType),
821    ),
822    (Scopes::Character, "is_busy", Boolean),
823    (Scopes::State, "is_capital", Boolean),
824    (Scopes::Character, "is_character_alive", Boolean),
825    (Scopes::CharacterRole, "is_character_role", Item(Item::CharacterRole)),
826    (Scopes::CharacterRole, "is_character_role_type", Item(Item::CharacterArchetype)),
827    (Scopes::CivilWar, "is_civil_war_type", Choice(&["revolution", "secession"])),
828    (Scopes::State, "is_coastal", Boolean),
829    (Scopes::Company, "is_company_type", ScopeOrItem(Scopes::CompanyType, Item::CompanyType)),
830    (Scopes::Country, "is_considered_adjacent_due_to_wargoals", Scope(Scopes::Country)),
831    (Scopes::Country, "is_construction_paused", Boolean),
832    (Scopes::MarketGoods, "is_consumed_by_government_buildings", Boolean),
833    (Scopes::MarketGoods, "is_consumed_by_military_buildings", Boolean),
834    (Scopes::Country, "is_country_alive", Boolean),
835    (Scopes::Country, "is_country_type", Item(Item::CountryType)),
836    (Scopes::Ship, "is_damaged", Boolean),
837    (Scopes::Character.union(Scopes::Ship), "is_defender_in_battle", Boolean),
838    (
839        Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions),
840        "is_desired_by",
841        Scope(Scopes::Country),
842    ),
843    (Scopes::DiplomaticPact, "is_diplomatic_action_type", Item(Item::DiplomaticAction)),
844    (Scopes::DiplomaticCatalyst, "is_diplomatic_catalyst_type", Item(Item::DiplomaticCatalyst)),
845    (Scopes::DiplomaticPact, "is_diplomatic_pact_in_danger", Boolean),
846    (Scopes::Country, "is_diplomatic_play_ally_of", Scope(Scopes::Country)),
847    (Scopes::Country, "is_diplomatic_play_committed_participant", Boolean),
848    (Scopes::Country, "is_diplomatic_play_enemy_of", Scope(Scopes::Country)),
849    (Scopes::Country, "is_diplomatic_play_initiator", Boolean),
850    (Scopes::Country, "is_diplomatic_play_involved_with", Scope(Scopes::Country)),
851    (Scopes::Country, "is_diplomatic_play_participant_with", Scope(Scopes::Country)),
852    (Scopes::Country, "is_diplomatic_play_target", Boolean),
853    (Scopes::DiplomaticPlay, "is_diplomatic_play_type", Item(Item::DiplomaticPlay)),
854    (Scopes::Country, "is_diplomatic_play_undecided_participant", Boolean),
855    (Scopes::Country, "is_direct_subject_of", Scope(Scopes::Country)),
856    (Scopes::MilitaryFormation, "is_doing_piracy_in_region", Scope(Scopes::StrategicRegion)),
857    (Scopes::Pop, "is_employed", Boolean),
858    (Scopes::Country, "is_enacting_law", Scope(Scopes::LawType)),
859    (Scopes::Treaty, "is_enforced", Boolean),
860    (
861        Scopes::Treaty.union(Scopes::TreatyOptions),
862        "is_equal_exchange",
863        Removed("1.9.8", "replaced with `is_equal_exchange_for`"),
864    ),
865    (Scopes::Treaty.union(Scopes::TreatyOptions), "is_equal_exchange_for", Scope(Scopes::Country)),
866    (Scopes::Treaty.union(Scopes::TreatyOptions), "is_exchanging_obligations", Boolean),
867    (Scopes::Country, "is_expanding_institution", Boolean),
868    (Scopes::MarketGoods, "is_exported_to", Scope(Scopes::Market)),
869    (Scopes::Character, "is_female", Boolean),
870    (Scopes::Ship, "is_flagship", Boolean),
871    (Scopes::MilitaryFormation, "is_fleet", Boolean),
872    (Scopes::DiplomaticPact, "is_forced_pact", Boolean),
873    (Scopes::Country, "is_forced_to_join_plays", Scope(Scopes::Country)),
874    (Scopes::Treaty, "is_fulfilled_by", Scope(Scopes::Country)),
875    (Scopes::MilitaryFormation, "is_fully_mobilized", Boolean),
876    (Scopes::None, "is_game_paused", Boolean),
877    (Scopes::None, "is_gamestate_tutorial_active", Boolean),
878    (
879        Scopes::TreatyOptions.union(Scopes::TreatyArticleOptions),
880        "is_giftable_to",
881        Scope(Scopes::Country),
882    ),
883    (Scopes::JournalEntry, "is_goal_complete", Boolean),
884    (Scopes::Building, "is_government_funded", Boolean),
885    (Scopes::Character, "is_heir", Removed("1.13", "replaced with `is_heir_of_own_country`")),
886    (Scopes::Character, "is_heir_of_own_country", Boolean),
887    (Scopes::Character, "is_historical", Boolean),
888    (Scopes::Treaty.union(Scopes::TreatyOptions), "is_historical_treaty", Boolean),
889    (Scopes::War, "is_holder_of_wargoal_in_war", Scope(Scopes::Country)),
890    (Scopes::Country, "is_home_country_for", Scope(Scopes::Country)),
891    (Scopes::StateRegion, "is_homeland", ScopeOrItem(Scopes::Culture, Item::Culture)),
892    (Scopes::State, "is_homeland_of_country_cultures", Scope(Scopes::Country)),
893    (Scopes::Character, "is_immortal", Boolean),
894    (Scopes::Country, "is_immune_to_revolutions", Boolean),
895    (Scopes::MarketGoods, "is_imported_from", Scope(Scopes::Market)),
896    (Scopes::Character.union(Scopes::Ship), "is_in_battle", Boolean),
897    (Scopes::Country, "is_in_customs_union", Boolean),
898    (Scopes::Country, "is_in_customs_union_with", Scope(Scopes::Country)),
899    (Scopes::Character, "is_in_exile_pool", Boolean),
900    (
901        Scopes::Country
902            .union(Scopes::State)
903            .union(Scopes::StateRegion)
904            .union(Scopes::StrategicRegion),
905        "is_in_geographic_region",
906        Item(Item::GeographicRegion),
907    ),
908    (Scopes::InterestGroup, "is_in_government", Boolean),
909    (Scopes::None, "is_in_list", Special),
910    (Scopes::Pop, "is_in_mild_starvation", Boolean),
911    (Scopes::Ship, "is_in_port", Boolean),
912    (Scopes::Country, "is_in_power_bloc", Boolean),
913    (Scopes::State, "is_in_revolt", Boolean),
914    (Scopes::State, "is_in_same_market_area", Scope(Scopes::State)),
915    (Scopes::Country, "is_in_same_power_bloc", Scope(Scopes::Country)),
916    (Scopes::Pop, "is_in_severe_starvation", Boolean),
917    (Scopes::Pop, "is_in_starvation", Boolean),
918    (Scopes::Character, "is_in_void", Boolean),
919    (Scopes::Country, "is_in_war_together", Scope(Scopes::Country)),
920    (Scopes::State, "is_incorporated", Boolean),
921    (Scopes::Country, "is_indirect_subject_of", Scope(Scopes::Country)),
922    (
923        Scopes::Country.union(Scopes::InterestGroup).union(Scopes::PoliticalMovement),
924        "is_insurrectionary",
925        Boolean,
926    ),
927    (Scopes::InterestMarker, "is_interest_active", Removed("1.13", "")),
928    (Scopes::Character, "is_interest_group_leader", Boolean),
929    (
930        Scopes::Character.union(Scopes::InterestGroup),
931        "is_interest_group_type",
932        Item(Item::InterestGroup),
933    ),
934    (Scopes::MilitaryFormation, "is_invalid_naval_mission_grace_period_active", Boolean),
935    (Scopes::Invasion, "is_invasion_stalled", Boolean),
936    (Scopes::Country, "is_involved_in_journal_entry", Item(Item::JournalEntry)),
937    (Scopes::State, "is_isolated_from_market", Boolean),
938    (Scopes::Country, "is_junior_in_customs_union", Boolean),
939    (Scopes::None, "is_key_in_global_variable_map", UncheckedTodo),
940    (Scopes::None, "is_key_in_local_variable_map", UncheckedTodo),
941    (Scopes::None, "is_key_in_variable_map", UncheckedTodo),
942    (Scopes::Theater, "is_land_theater", Boolean),
943    (Scopes::State, "is_largest_state_in_region", Boolean),
944    (Scopes::None, "is_lens_open", Block(&[("lens", UncheckedTodo), ("?tab_name", UncheckedTodo)])),
945    (Scopes::Country, "is_local_country", Scope(Scopes::StrategicRegion)),
946    (Scopes::Country, "is_local_player", Boolean),
947    (Scopes::Country, "is_losing_power_rank", Boolean),
948    (Scopes::CountryFormation, "is_major_formation", Boolean),
949    (Scopes::InterestGroup, "is_marginal", Boolean),
950    (Scopes::Country, "is_market_reachable_for_trade", Scope(Scopes::Market)),
951    (Scopes::Country, "is_mass_migration_origin", Boolean),
952    (Scopes::Country, "is_mass_migration_origin_of_culture", Scope(Scopes::Culture)),
953    (Scopes::State, "is_mass_migration_target", Boolean),
954    (Scopes::State, "is_mass_migration_target_for_culture", Scope(Scopes::Culture)),
955    (Scopes::InterestGroup, "is_member_of_any_lobby", Boolean),
956    (Scopes::InterestGroup, "is_member_of_lobby", Scope(Scopes::PoliticalLobbyType)),
957    (Scopes::InterestGroup, "is_member_of_party", Scope(Scopes::Party)),
958    (Scopes::MilitaryFormation, "is_mobilized", Boolean),
959    (Scopes::Character, "is_monarch", Boolean),
960    (Scopes::Invasion, "is_naval_invasion", Boolean),
961    (
962        Scopes::None,
963        "is_naval_invasion_stalled_due_to_orders",
964        Removed("1.9", "replaced with `is_invasion_stalled`"),
965    ),
966    (Scopes::Country.union(Scopes::InterestGroup), "is_negotiating", Boolean),
967    (Scopes::Character, "is_noble", Boolean),
968    (
969        Scopes::Country
970            .union(Scopes::State)
971            .union(Scopes::StateRegion)
972            .union(Scopes::StrategicRegion),
973        "is_not_in_geographic_region",
974        Item(Item::GeographicRegion),
975    ),
976    (Scopes::None, "is_objective_completed", Boolean),
977    (Scopes::Character.union(Scopes::MilitaryFormation), "is_on_front", Boolean),
978    (Scopes::Country, "is_owed_obligation_by", Scope(Scopes::Country)),
979    (
980        Scopes::None,
981        "is_panel_open",
982        Block(&[
983            ("?target", UncheckedTodo),
984            ("?panel_name", UncheckedTodo),
985            ("?tab_name", UncheckedTodo),
986        ]),
987    ),
988    (Scopes::Party, "is_party", Scope(Scopes::Party)),
989    (Scopes::Party, "is_party_type", Item(Item::Party)),
990    (Scopes::Country, "is_player", Boolean),
991    (Scopes::PoliticalLobby, "is_political_lobby_type", Item(Item::PoliticalLobby)),
992    (Scopes::PoliticalMovement, "is_political_movement_type", Item(Item::PoliticalMovement)),
993    (Scopes::Pop, "is_pop_type", Item(Item::PopType)),
994    (Scopes::None, "is_popup_open", UncheckedTodo),
995    (Scopes::State, "is_potential_treaty_port", Scope(Scopes::Country)),
996    (Scopes::Country, "is_power_bloc_leader", Boolean),
997    (Scopes::InterestGroup, "is_powerful", Boolean),
998    (Scopes::Culture, "is_primary_culture_of", Scope(Scopes::Country)),
999    (Scopes::Company, "is_producing_prestige_goods", Boolean),
1000    (
1001        Scopes::State,
1002        "is_production_method_active",
1003        Block(&[
1004            ("building_type", Item(Item::BuildingType)),
1005            ("production_method", Item(Item::ProductionMethod)),
1006        ]),
1007    ),
1008    (Scopes::JournalEntry, "is_progressing", Boolean),
1009    (Scopes::Province, "is_province_land", Boolean),
1010    (Scopes::Law, "is_reasonable_law_for_petition", Boolean),
1011    (Scopes::Treaty.union(Scopes::TreatyOptions), "is_renegotiation", Boolean),
1012    (Scopes::Character, "is_repairing", Removed("1.6", "")),
1013    (Scopes::Country, "is_researching_technology", Special), // also accepts "any"
1014    (Scopes::Country, "is_researching_technology_category", UncheckedTodo), // No examples in vanilla
1015    (
1016        Scopes::Country.union(Scopes::InterestGroup).union(Scopes::PoliticalMovement),
1017        "is_revolutionary",
1018        Boolean,
1019    ),
1020    (
1021        Scopes::PoliticalMovement,
1022        "is_revolutionary_movement",
1023        Removed("1.8", "replaced with is_revolutionary"),
1024    ),
1025    (Scopes::None, "is_rightclick_menu_open", UncheckedTodo),
1026    (Scopes::Character, "is_ruler", Removed("1.13", "replaced by three `is_ruler_of_` triggers")),
1027    (Scopes::Character, "is_ruler_of_any_country", Boolean),
1028    (Scopes::Character, "is_ruler_of_other_country", Boolean),
1029    (Scopes::Character, "is_ruler_of_own_country", Boolean),
1030    (Scopes::InterestGroup, "is_same_interest_group_type", Scope(Scopes::InterestGroup)),
1031    (Scopes::LawType, "is_same_law_group_as", Scope(Scopes::LawType)),
1032    (Scopes::Party, "is_same_party_type", Scope(Scopes::Party)),
1033    (Scopes::State, "is_sea_adjacent", Boolean),
1034    (
1035        Scopes::Country.union(Scopes::InterestGroup).union(Scopes::PoliticalMovement),
1036        "is_secessionist",
1037        Boolean,
1038    ),
1039    (Scopes::None, "is_set", Special),
1040    (Scopes::Ship, "is_ship_obsolete_for", Scope(Scopes::Country)),
1041    (Scopes::Ship, "is_ship_type", Scope(Scopes::ShipType)),
1042    (Scopes::Ship, "is_ship_very_obsolete_for", Scope(Scopes::Country)),
1043    (Scopes::State, "is_slave_state", Boolean),
1044    (Scopes::State, "is_split_state", Boolean),
1045    (Scopes::StateRegion, "is_state_region_land", Boolean),
1046    (Scopes::Religion, "is_state_religion", Scope(Scopes::Country)),
1047    (Scopes::State, "is_strategic_objective", Scope(Scopes::Country)),
1048    (Scopes::InterestGroup, "is_strongest_ig_in_government", Boolean),
1049    (Scopes::Country, "is_subject", Boolean),
1050    (Scopes::Country, "is_subject_of", Scope(Scopes::Country)),
1051    (Scopes::Country, "is_subject_type", Item(Item::SubjectType)),
1052    (Scopes::Building, "is_subsidized", Boolean),
1053    (Scopes::Building, "is_subsistence_building", Boolean),
1054    (
1055        Scopes::Country,
1056        "is_supporting_unification_candidate",
1057        Block(&[
1058            ("who", Scope(Scopes::Country)),
1059            ("country_formation", Item(Item::CountryFormation)),
1060        ]),
1061    ),
1062    (Scopes::War, "is_target_of_wargoal_in_war", Scope(Scopes::Country)),
1063    (Scopes::None, "is_target_in_global_variable_list", Special),
1064    (Scopes::None, "is_target_in_local_variable_list", Special),
1065    (Scopes::None, "is_target_in_variable_list", Special),
1066    (Scopes::State, "is_target_of_wargoal", Scope(Scopes::Country)),
1067    (Scopes::Country, "is_taxing_goods", ScopeOrItem(Scopes::Goods, Item::Goods)),
1068    (Scopes::None, "is_template_used", Item(Item::CharacterTemplate)),
1069    (Scopes::None, "is_theme_selected", Item(Item::Theme)),
1070    (Scopes::None, "is_trade_route_active", Removed("1.9", "replaced with world market system")),
1071    (
1072        Scopes::None,
1073        "is_trade_route_productive",
1074        Removed("1.9", "replaced with world market system"),
1075    ),
1076    (Scopes::Goods.union(Scopes::MarketGoods), "is_tradeable", Boolean),
1077    (Scopes::Character, "is_traveling", Removed("1.6", "")),
1078    (Scopes::TreatyArticle, "is_treaty_article_in_danger", Boolean),
1079    (Scopes::State, "is_treaty_port", Boolean),
1080    (Scopes::None, "is_tutorial_active", Boolean),
1081    (Scopes::None, "is_tutorial_lesson_active", Item(Item::TutorialLesson)),
1082    (Scopes::None, "is_tutorial_lesson_chain_completed", UncheckedTodo), // TODO
1083    (Scopes::None, "is_tutorial_lesson_completed", Item(Item::TutorialLesson)),
1084    (Scopes::None, "is_tutorial_lesson_step_completed", UncheckedTodo), // TODO
1085    (Scopes::State, "is_under_colonization", Boolean),
1086    (Scopes::Building, "is_under_construction", Boolean),
1087    (Scopes::Country, "is_unification_candidate", Item(Item::CountryFormation)),
1088    (Scopes::None, "is_value_in_global_variable_map", UncheckedTodo),
1089    (Scopes::None, "is_value_in_local_variable_map", UncheckedTodo),
1090    (Scopes::None, "is_value_in_variable_map", UncheckedTodo),
1091    (Scopes::Country, "is_violating_sovereignty_of", Scope(Scopes::Country)),
1092    (Scopes::Front, "is_vulnerable_front", Scope(Scopes::Country)),
1093    (Scopes::DiplomaticPlay, "is_war", Boolean),
1094    (Scopes::War, "is_war_participant", Scope(Scopes::Country)),
1095    (Scopes::War, "is_warleader", Scope(Scopes::Country)),
1096    (Scopes::State, "is_world_market_hub", Boolean),
1097    (Scopes::Country, "isolated_states", CompareValue),
1098    (Scopes::JournalEntry, "journal_entry_age", CompareValue),
1099    (Scopes::Law, "law_approved_by", Scope(Scopes::InterestGroup)),
1100    (
1101        Scopes::Character.union(Scopes::InterestGroup).union(Scopes::PoliticalMovement),
1102        "law_enactment_stance",
1103        Block(&[("law", Scope(Scopes::LawType)), ("value", CompareChoice(STANCES))]),
1104    ),
1105    (Scopes::Law, "law_is_available", Boolean),
1106    (
1107        Scopes::LawType,
1108        "law_progressiveness_difference",
1109        Block(&[("target_law", Scope(Scopes::LawType)), ("value", CompareValue)]), // TODO verify
1110    ),
1111    (
1112        Scopes::Character.union(Scopes::InterestGroup).union(Scopes::PoliticalMovement),
1113        "law_stance",
1114        Block(&[("law", Scope(Scopes::LawType)), ("value", CompareChoice(STANCES))]),
1115    ),
1116    (Scopes::Country, "leading_producer_of", Scope(Scopes::Goods)),
1117    (Scopes::Country, "leads_customs_union", Boolean),
1118    (
1119        Scopes::Building,
1120        "levels_owned_by_country",
1121        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1122    ),
1123    (
1124        Scopes::PowerBloc,
1125        "leverage_advantage",
1126        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1127    ),
1128    (Scopes::Country, "liberty_desire", CompareValue),
1129    (Scopes::Country, "liberty_desire_weekly_progress", CompareValue),
1130    (Scopes::Country, "liberty_desire_weekly_progress_from_support_independence", CompareValue),
1131    (Scopes::Character, "lifetime_piracy_income", CompareValue),
1132    (
1133        Scopes::None,
1134        "list_size",
1135        Block(&[("name", Identifier("list name")), ("value", CompareValue)]),
1136    ),
1137    (Scopes::Country.union(Scopes::Pop).union(Scopes::State), "literacy_rate", CompareValue),
1138    (Scopes::PoliticalLobby, "lobby_clout", CompareValue),
1139    (
1140        Scopes::DiplomaticCatalyst.union(Scopes::PoliticalLobby),
1141        "lobby_formation_reason",
1142        Choice(LOBBY_FORMATION_REASON),
1143    ),
1144    (Scopes::None, "local_variable_list_size", Special),
1145    (Scopes::None, "local_variable_map_size", UncheckedTodo),
1146    (
1147        Scopes::Country.union(Scopes::State),
1148        "loyalist_fraction",
1149        BlockOrCompareValue(&[
1150            ("value", CompareValue),
1151            ("?pop_type", Item(Item::PopType)),
1152            ("?strata", Item(Item::Strata)),
1153            ("?culture", ScopeOrItem(Scopes::Culture, Item::Culture)),
1154            ("?religion", ScopeOrItem(Scopes::Religion, Item::Religion)),
1155        ]),
1156    ),
1157    (Scopes::State, "loyalists", CompareValue),
1158    (Scopes::Character, "loyalty", CompareValue),
1159    (Scopes::State, "market_access", CompareValue),
1160    (
1161        Scopes::Market,
1162        "market_consumption_share",
1163        Block(&[
1164            ("?target", Scope(Scopes::Country)),
1165            ("?goods", Item(Item::Goods)),
1166            ("value", CompareValue),
1167        ]),
1168    ),
1169    (
1170        Scopes::Market,
1171        "market_exports",
1172        Block(&[
1173            ("?target", Scope(Scopes::Market)),
1174            ("?goods", Item(Item::Goods)),
1175            ("value", CompareValue),
1176        ]),
1177    ),
1178    (
1179        Scopes::Market,
1180        "market_exports_reliance",
1181        Block(&[
1182            ("?target", Scope(Scopes::Market)),
1183            ("?goods", Item(Item::Goods)),
1184            ("value", CompareValue),
1185        ]),
1186    ),
1187    (Scopes::MarketGoods, "market_goods_buy_orders", CompareValue),
1188    (Scopes::MarketGoods, "market_goods_cheaper", CompareValue),
1189    (Scopes::MarketGoods, "market_goods_consumption", CompareValue),
1190    (Scopes::MarketGoods, "market_goods_delta", CompareValue),
1191    (Scopes::MarketGoods, "market_goods_export_share", CompareValue),
1192    (Scopes::MarketGoods, "market_goods_exports", CompareValue),
1193    (Scopes::MarketGoods, "market_goods_has_goods_shortage", Boolean),
1194    (Scopes::MarketGoods, "market_goods_import_share", CompareValue),
1195    (Scopes::MarketGoods, "market_goods_imports", CompareValue),
1196    (Scopes::MarketGoods, "market_goods_pricier", CompareValue),
1197    (Scopes::MarketGoods, "market_goods_production", CompareValue),
1198    (Scopes::MarketGoods, "market_goods_sell_orders", CompareValue),
1199    (Scopes::MarketGoods, "market_goods_shortage_ratio", CompareValue),
1200    (Scopes::Market, "market_has_goods_shortage", Boolean),
1201    (
1202        Scopes::Market,
1203        "market_imports",
1204        Block(&[
1205            ("?target", Scope(Scopes::Market)),
1206            ("?goods", Item(Item::Goods)),
1207            ("value", CompareValue),
1208        ]),
1209    ),
1210    (
1211        Scopes::Market,
1212        "market_imports_reliance",
1213        Block(&[
1214            ("?target", Scope(Scopes::Market)),
1215            ("?goods", Item(Item::Goods)),
1216            ("value", CompareValue),
1217        ]),
1218    ),
1219    (Scopes::Market, "market_number_goods_shortages", CompareValue),
1220    (
1221        Scopes::Market,
1222        "market_number_goods_shortages_with",
1223        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1224    ),
1225    (
1226        Scopes::Market,
1227        "market_number_goods_shortages_without",
1228        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1229    ),
1230    (
1231        Scopes::MarketGoods,
1232        "market_prestige_goods_buy_orders",
1233        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1234    ),
1235    (
1236        Scopes::MarketGoods,
1237        "market_prestige_goods_consumption",
1238        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1239    ),
1240    (
1241        Scopes::MarketGoods,
1242        "market_prestige_goods_delta",
1243        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1244    ),
1245    (
1246        Scopes::MarketGoods,
1247        "market_prestige_goods_export_share",
1248        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1249    ),
1250    (
1251        Scopes::MarketGoods,
1252        "market_prestige_goods_exports",
1253        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1254    ),
1255    (
1256        Scopes::MarketGoods,
1257        "market_prestige_goods_import_share",
1258        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1259    ),
1260    (
1261        Scopes::MarketGoods,
1262        "market_prestige_goods_imports",
1263        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1264    ),
1265    (
1266        Scopes::MarketGoods,
1267        "market_prestige_goods_production",
1268        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1269    ),
1270    (
1271        Scopes::MarketGoods,
1272        "market_prestige_goods_sell_orders",
1273        Block(&[("type", Item(Item::PrestigeGoods)), ("value", CompareValue)]),
1274    ),
1275    (
1276        Scopes::Market,
1277        "market_production_share",
1278        Block(&[
1279            ("?target", Scope(Scopes::Country)),
1280            ("?goods", Item(Item::Goods)),
1281            ("value", CompareValue),
1282        ]),
1283    ),
1284    (
1285        Scopes::Market,
1286        "market_trade",
1287        Block(&[
1288            ("?target", Scope(Scopes::Market)),
1289            ("?goods", Item(Item::Goods)),
1290            ("value", CompareValue),
1291        ]),
1292    ),
1293    (
1294        Scopes::Market,
1295        "market_trade_reliance",
1296        Block(&[
1297            ("?target", Scope(Scopes::Market)),
1298            ("?goods", Item(Item::Goods)),
1299            ("value", CompareValue),
1300        ]),
1301    ),
1302    (Scopes::TreatyArticle.union(Scopes::TreatyArticleOptions), "max_contraventions", CompareValue),
1303    (Scopes::Country, "max_law_enactment_setbacks", CompareValue),
1304    (Scopes::MilitaryFormation, "max_organization", Removed("1.9", "")),
1305    (Scopes::Country, "max_num_companies", CompareValue),
1306    (Scopes::Country, "max_num_declared_interests", Removed("1.13", "")),
1307    (Scopes::Country, "military_ship_maintenance_fulfillment", CompareValue),
1308    (Scopes::Country, "military_wage_level", CompareChoice(LEVELS)),
1309    (Scopes::Country, "military_wage_level_value", CompareValue),
1310    (Scopes::Character, "mobilization_cost", Removed("1.5", "")),
1311    (Scopes::None, "month", CompareValue), // TODO: 0 to 11
1312    (Scopes::InterestGroup, "most_powerful_strata", Item(Item::Strata)),
1313    (Scopes::State, "most_prominent_revolting_interest_group", Item(Item::InterestGroup)),
1314    (Scopes::PoliticalMovement, "movement_can_cause_obstinance", Boolean),
1315    (Scopes::PoliticalMovement, "movement_is_causing_obstinance", Boolean),
1316    (Scopes::PoliticalMovement, "movement_pressure", UncheckedTodo), // no examples of non-complex form
1317    (Scopes::None, "nand", Control),
1318    (
1319        Scopes::Country,
1320        "nationalization_cost",
1321        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1322    ),
1323    (Scopes::Country, "naval_power_projection", CompareValue),
1324    (Scopes::Country, "navy_reserves", Removed("1.6", "")),
1325    (Scopes::Country, "neighbors_any_power_bloc", Boolean),
1326    (Scopes::Country, "neighbors_member_of_same_power_bloc", Boolean),
1327    (Scopes::Country, "neighbors_power_bloc", Scope(Scopes::PowerBloc)),
1328    (Scopes::Country, "net_fixed_income", CompareValueWarnEq),
1329    (Scopes::Country, "net_total_income", CompareValueWarnEq),
1330    (Scopes::None, "night_value", CompareValue),
1331    (Scopes::None, "nor", Control),
1332    (Scopes::None, "not", Control),
1333    (Scopes::War, "num_casualties", CompareValue),
1334    (Scopes::Country, "num_companies", CompareValue),
1335    (
1336        Scopes::TreatyArticle,
1337        "num_contraventions",
1338        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1339    ),
1340    (
1341        Scopes::War,
1342        "num_country_casualties",
1343        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1344    ),
1345    (
1346        Scopes::War,
1347        "num_country_dead",
1348        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1349    ),
1350    (
1351        Scopes::War,
1352        "num_country_wounded",
1353        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1354    ),
1355    (Scopes::State, "num_cultural_communities", CompareValue),
1356    (Scopes::War, "num_dead", CompareValue),
1357    (Scopes::Country, "num_declared_interests", Removed("1.13", "")),
1358    // TODO: check that the DiplomaticAction has a pact.
1359    (
1360        Scopes::Country,
1361        "num_diplomatic_pacts",
1362        Block(&[("type", Item(Item::DiplomaticAction)), ("value", CompareValue)]),
1363    ),
1364    (
1365        Scopes::Front,
1366        "num_front_casualties",
1367        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1368    ),
1369    (
1370        Scopes::Front,
1371        "num_front_dead",
1372        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1373    ),
1374    (
1375        Scopes::Front,
1376        "num_front_wounded",
1377        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1378    ),
1379    (
1380        Scopes::Country,
1381        "num_investments_of_type",
1382        Block(&[("type", Item(Item::BuildingType)), ("value", CompareValue)]),
1383    ),
1384    (Scopes::Theater, "num_mobilized_units_in_theater", CompareValue),
1385    (Scopes::Country.union(Scopes::InterestGroup), "num_political_lobbies", CompareValue),
1386    (Scopes::State, "num_potential_resources", UncheckedTodo), // no examples of non-complex form
1387    (Scopes::PowerBloc, "num_power_bloc_members", CompareValue),
1388    (Scopes::PowerBloc, "num_power_bloc_states", CompareValue),
1389    (Scopes::Theater, "num_provinces_in_theater", CompareValue),
1390    (Scopes::Country, "num_subjects", CompareValue),
1391    (Scopes::Country, "num_taxed_goods", CompareValue),
1392    (Scopes::War, "num_wounded", CompareValue),
1393    (Scopes::Country, "number_of_claims", CompareValue),
1394    (Scopes::Country, "number_of_possible_decisions", CompareValue),
1395    (Scopes::State, "obstinance", CompareValue),
1396    (Scopes::Building, "occupancy", CompareValue),
1397    (Scopes::None, "or", Control),
1398    (Scopes::MilitaryFormation, "organization", CompareValue),
1399    (Scopes::MilitaryFormation, "organization_target", CompareValue),
1400    (Scopes::Country, "overlord_can_decrease_subject_autonomy", Boolean),
1401    (Scopes::Country, "owes_obligation_to", Scope(Scopes::Country)),
1402    (
1403        Scopes::Country,
1404        "owns_entire_state_region",
1405        ScopeOrItem(Scopes::StateRegion, Item::StateRegion),
1406    ),
1407    (Scopes::Country, "owns_treaty_port_in", ScopeOrItem(Scopes::StateRegion, Item::StateRegion)),
1408    (
1409        Scopes::Country,
1410        "play_participant_has_war_goal_of_type_against",
1411        Block(&[("type", Item(Item::WarGoalType)), ("target", Scope(Scopes::Country))]),
1412    ),
1413    (
1414        Scopes::Country,
1415        "play_side_has_war_goal_of_type_against",
1416        Block(&[("type", Item(Item::WarGoalType)), ("target", Scope(Scopes::Country))]),
1417    ),
1418    (Scopes::PoliticalMovement, "political_movement_identity_support", CompareValue),
1419    (Scopes::PoliticalMovement, "political_movement_military_support", CompareValue),
1420    (Scopes::PoliticalMovement, "political_movement_popular_support", CompareValue),
1421    (Scopes::PoliticalMovement, "political_movement_radicalism", CompareValue),
1422    (Scopes::PoliticalMovement, "political_movement_support", CompareValue),
1423    (Scopes::PoliticalMovement, "political_movement_wealth_support", CompareValue),
1424    // TODO: exactly one of pop_type, religion, or culture must be specified
1425    (
1426        Scopes::Country.union(Scopes::State),
1427        "political_strength_share",
1428        Block(&[
1429            ("?pop_type", ScopeOrItem(Scopes::PopType, Item::PopType)),
1430            ("?religion", ScopeOrItem(Scopes::Religion, Item::Religion)),
1431            ("?culture", ScopeOrItem(Scopes::Culture, Item::Culture)),
1432            ("value", CompareValue),
1433        ]),
1434    ),
1435    (Scopes::Country, "politically_involved_ratio", CompareValue),
1436    (Scopes::StateRegion, "pollution_amount", CompareValue),
1437    (Scopes::State, "pollution_generation", CompareValue),
1438    (Scopes::Pop, "pop_acceptance", CompareValue),
1439    (Scopes::Pop, "pop_employment_building", Item(Item::BuildingType)),
1440    (Scopes::Pop, "pop_employment_building_group", Item(Item::BuildingGroup)),
1441    (Scopes::Pop, "pop_has_primary_culture", Boolean),
1442    (Scopes::Pop, "pop_is_discriminated", Removed("1.8", "replaced with pop_acceptance")),
1443    (Scopes::Pop, "pop_loyalist_fraction", CompareValue),
1444    (Scopes::Pop, "pop_neutral_fraction", CompareValue),
1445    (Scopes::Pop, "pop_radical_fraction", CompareValue),
1446    (
1447        Scopes::Country,
1448        "pop_type_percent_country",
1449        Block(&[("pop_type", Item(Item::PopType)), ("percent", CompareValue)]),
1450    ),
1451    (
1452        Scopes::State,
1453        "pop_type_percent_state",
1454        Block(&[("target", Scope(Scopes::PopType)), ("value", CompareValue)]),
1455    ),
1456    (
1457        Scopes::State,
1458        "population_by_culture",
1459        Block(&[("target", Scope(Scopes::Culture)), ("value", CompareValue)]),
1460    ),
1461    (
1462        Scopes::Country,
1463        "potential_diplomatic_play_power_ratio",
1464        Block(&[
1465            ("?type", Item(Item::DiplomaticPlay)),
1466            ("target", Scope(Scopes::Country)),
1467            ("?state", Scope(Scopes::State)),
1468            ("value", CompareValue),
1469        ]),
1470    ),
1471    (Scopes::Country, "potential_income", CompareValue),
1472    (Scopes::PowerBloc, "power_bloc_rank", CompareValue),
1473    (Scopes::Country, "power_bloc_share_gdp", CompareValue),
1474    (
1475        Scopes::Country,
1476        "power_bloc_share_gdp_with",
1477        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1478    ),
1479    (
1480        Scopes::Country,
1481        "power_bloc_share_gdp_without",
1482        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1483    ),
1484    (Scopes::Country, "power_bloc_share_power_projection", CompareValue),
1485    (
1486        Scopes::Country,
1487        "power_bloc_share_power_projection_with",
1488        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1489    ),
1490    (
1491        Scopes::Country,
1492        "power_bloc_share_power_projection_without",
1493        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1494    ),
1495    (Scopes::Country, "power_bloc_share_prestige", CompareValue),
1496    (
1497        Scopes::Country,
1498        "power_bloc_share_prestige_with",
1499        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1500    ),
1501    (
1502        Scopes::Country,
1503        "power_bloc_share_prestige_without",
1504        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1505    ),
1506    (Scopes::PowerBloc, "power_bloc_total_leading_goods_producers", CompareValue),
1507    (
1508        Scopes::PowerBloc,
1509        "power_bloc_total_leading_goods_producers_with",
1510        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1511    ),
1512    (
1513        Scopes::PowerBloc,
1514        "power_bloc_total_leading_goods_producers_without",
1515        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1516    ),
1517    (Scopes::PowerBloc, "power_bloc_worst_economic_dependence", CompareValue),
1518    (
1519        Scopes::PowerBloc,
1520        "power_bloc_worst_economic_dependence_with",
1521        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1522    ),
1523    (
1524        Scopes::PowerBloc,
1525        "power_bloc_worst_economic_dependence_without",
1526        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1527    ),
1528    (Scopes::PowerBloc, "power_bloc_worst_infamy", CompareValue),
1529    (
1530        Scopes::PowerBloc,
1531        "power_bloc_worst_infamy_with",
1532        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1533    ),
1534    (
1535        Scopes::PowerBloc,
1536        "power_bloc_worst_infamy_without",
1537        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1538    ),
1539    (Scopes::PowerBloc, "power_bloc_worst_leader_relations", CompareValue),
1540    (
1541        Scopes::PowerBloc,
1542        "power_bloc_worst_leader_relations_with",
1543        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1544    ),
1545    (
1546        Scopes::PowerBloc,
1547        "power_bloc_worst_leader_relations_without",
1548        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1549    ),
1550    (Scopes::PowerBloc, "power_bloc_worst_leader_religion_population_fraction", CompareValue),
1551    (
1552        Scopes::PowerBloc,
1553        "power_bloc_worst_leader_religion_population_fraction_with",
1554        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1555    ),
1556    (
1557        Scopes::PowerBloc,
1558        "power_bloc_worst_leader_religion_population_fraction_without",
1559        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1560    ),
1561    (Scopes::PowerBloc, "power_bloc_worst_liberty_desire", CompareValue),
1562    (
1563        Scopes::PowerBloc,
1564        "power_bloc_worst_liberty_desire_with",
1565        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1566    ),
1567    (
1568        Scopes::PowerBloc,
1569        "power_bloc_worst_liberty_desire_without",
1570        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1571    ),
1572    (
1573        Scopes::PowerBloc,
1574        "power_bloc_worst_progressiveness_difference_government_type",
1575        CompareValue,
1576    ),
1577    (
1578        Scopes::PowerBloc,
1579        "power_bloc_worst_progressiveness_difference_government_type_with",
1580        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1581    ),
1582    (
1583        Scopes::PowerBloc,
1584        "power_bloc_worst_progressiveness_difference_government_type_without",
1585        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]), // TODO verify
1586    ),
1587    (Scopes::Ship, "power_projection_value", CompareValue),
1588    (
1589        Scopes::PowerBloc,
1590        "predicted_cohesion_percentage_with",
1591        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1592    ),
1593    (
1594        Scopes::InterestGroup,
1595        "prefers_law",
1596        Block(&[("law", Scope(Scopes::LawType)), ("comparison_law", Scope(Scopes::LawType))]),
1597    ),
1598    (Scopes::Country, "prestige", CompareValue),
1599    (Scopes::Country, "primary_cultures_percent_country", CompareValue),
1600    (Scopes::State, "primary_cultures_percent_state", CompareValue),
1601    (Scopes::Character, "primary_role", Item(Item::CharacterRole)),
1602    (Scopes::Building, "private_ownership_fraction", CompareValue),
1603    (Scopes::Country, "produced_authority", CompareValue),
1604    (Scopes::Country, "produced_bureaucracy", CompareValue),
1605    (Scopes::Country, "produced_influence", CompareValue),
1606    (Scopes::LawType, "progressiveness", CompareValue),
1607    (Scopes::Character, "prominence", CompareValue),
1608    (Scopes::Pop, "quality_of_life", CompareValue),
1609    (
1610        Scopes::Country.union(Scopes::State),
1611        "radical_fraction",
1612        BlockOrCompareValue(&[
1613            ("value", CompareValue),
1614            ("?pop_type", Item(Item::PopType)),
1615            ("?strata", Item(Item::Strata)),
1616            ("?culture", ScopeOrItem(Scopes::Culture, Item::Culture)),
1617            ("?religion", ScopeOrItem(Scopes::Religion, Item::Religion)),
1618        ]),
1619    ),
1620    (Scopes::Country, "radical_population_fraction", CompareValue),
1621    (Scopes::None, "real_month", CompareValue),
1622    (
1623        Scopes::Country,
1624        "region_score",
1625        Block(&[("strategic_region", Scope(Scopes::StrategicRegion)), ("value", CompareValue)]),
1626    ),
1627    (Scopes::Country, "relative_authority", CompareValue),
1628    (Scopes::Country, "relative_bureaucracy", CompareValue),
1629    (Scopes::StateGoods, "relative_export_advantage", CompareValue),
1630    (Scopes::StateGoods, "relative_import_advantage", CompareValue),
1631    (Scopes::Country, "relative_influence", CompareValue),
1632    (Scopes::State, "relative_infrastructure", CompareValue),
1633    (Scopes::Pop, "religion_accepted", Removed("1.8", "")),
1634    (
1635        Scopes::Country,
1636        "religion_percent_country",
1637        Block(&[("target", Scope(Scopes::Religion)), ("value", CompareValue)]),
1638    ),
1639    (
1640        Scopes::State,
1641        "religion_percent_state",
1642        Block(&[("target", Scope(Scopes::Religion)), ("value", CompareValue)]),
1643    ),
1644    (
1645        Scopes::Character,
1646        "remaining_career_length",
1647        Block(&[("?role", Item(Item::CharacterRole)), ("years", CompareValue)]),
1648    ),
1649    (
1650        Scopes::StateRegion,
1651        "remaining_undepleted",
1652        Block(&[("type", Item(Item::BuildingType)), ("amount", CompareValue)]),
1653    ),
1654    (Scopes::CharacterRole, "role_priority", CompareValue),
1655    (Scopes::Country, "ruler_can_have_command", Boolean),
1656    (Scopes::all_but_none(), "save_temporary_scope_as", Special),
1657    (Scopes::None, "save_temporary_scope_value_as", Special),
1658    (Scopes::Country, "scaled_debt", CompareValue),
1659    (Scopes::Country, "scaled_gold_reserves", CompareValue),
1660    (
1661        Scopes::JournalEntry,
1662        "scripted_bar_progress",
1663        Block(&[("name", Item(Item::ScriptedProgressBar)), ("value", CompareValue)]),
1664    ),
1665    (Scopes::Building, "self_ownership_fraction", CompareValue),
1666    (
1667        Scopes::Culture,
1668        "shares_heritage_and_other_trait_with_any_primary_culture",
1669        Removed("1.10", ""),
1670    ),
1671    (
1672        Scopes::Culture,
1673        "shares_heritage_trait_group_with_any_primary_culture",
1674        Scope(Scopes::Country),
1675    ),
1676    (Scopes::Culture, "shares_heritage_trait_group_with_culture", Scope(Scopes::Culture)),
1677    (Scopes::Religion, "shares_heritage_trait_group_with_religion", Scope(Scopes::Religion)),
1678    (Scopes::Religion, "shares_heritage_trait_group_with_state_religion", Scope(Scopes::Country)),
1679    (Scopes::Culture, "shares_heritage_trait_with_any_primary_culture", Scope(Scopes::Country)),
1680    (Scopes::Culture, "shares_heritage_trait_with_culture", Scope(Scopes::Culture)),
1681    (Scopes::Religion, "shares_heritage_trait_with_culture", Scope(Scopes::Religion)),
1682    (Scopes::Religion, "shares_heritage_trait_with_religion", Scope(Scopes::Religion)),
1683    (Scopes::Religion, "shares_heritage_trait_with_state_religion", Scope(Scopes::Country)),
1684    (
1685        Scopes::Culture,
1686        "shares_language_trait_group_with_any_primary_culture",
1687        Scope(Scopes::Country),
1688    ),
1689    (Scopes::Culture, "shares_language_trait_group_with_culture", Scope(Scopes::Culture)),
1690    (Scopes::Culture, "shares_language_trait_with_any_primary_culture", Scope(Scopes::Country)),
1691    (Scopes::Culture, "shares_language_trait_with_culture", Scope(Scopes::Culture)),
1692    (Scopes::Culture, "shares_non_heritage_trait_with_any_primary_culture", Removed("1.10", "")),
1693    (Scopes::Culture, "shares_tradition_trait_with_any_primary_culture", Scope(Scopes::Country)),
1694    (Scopes::Culture, "shares_tradition_trait_with_culture", Scope(Scopes::Culture)),
1695    (Scopes::Culture, "shares_trait_with_any_primary_culture", Removed("1.10", "")),
1696    (Scopes::Religion, "shares_trait_with_state_religion", Removed("1.10", "")),
1697    (Scopes::Country, "ship_modification_market_demand_ratio", UncheckedTodo),
1698    (
1699        Scopes::Country,
1700        "should_set_wargoal",
1701        Block(&[("target", Scope(Scopes::DiplomaticPlay)), ("?value", Boolean)]),
1702    ),
1703    (Scopes::None, "should_show_nudity", Boolean),
1704    (Scopes::Country, "shrinking_institution", Item(Item::Institution)),
1705    (
1706        Scopes::Country,
1707        "size_weighted_lost_battles_fraction",
1708        Block(&[("target", Scope(Scopes::War)), ("value", CompareValue)]),
1709    ),
1710    (Scopes::Country, "sol_ranking", CompareValue),
1711    (Scopes::CharacterRole, "spawns_characters_to_pool", Boolean),
1712    (Scopes::Ship, "speed", CompareValue),
1713    (Scopes::Country, "stall_chance", CompareValue),
1714    (
1715        Scopes::Country,
1716        "stall_chance_for_law",
1717        Block(&[("target", Scope(Scopes::LawType)), ("value", CompareValue)]),
1718    ),
1719    (
1720        Scopes::Country,
1721        "stall_chance_for_law_without_enactment_modifier",
1722        Block(&[("target", Scope(Scopes::LawType)), ("value", CompareValue)]),
1723    ),
1724    (Scopes::Country, "stall_chance_without_enactment_modifier", CompareValue),
1725    (Scopes::Pop, "standard_of_living", CompareValue),
1726    (Scopes::BattleSide, "starting_manpower", CompareValue),
1727    (
1728        Scopes::State,
1729        "state_average_culture_and_religion_pop_acceptance",
1730        Block(&[
1731            ("culture", Scope(Scopes::Culture)),
1732            ("religion", Scope(Scopes::Religion)),
1733            ("value", CompareValue),
1734        ]),
1735    ),
1736    (
1737        Scopes::State,
1738        "state_average_culture_pop_acceptance",
1739        Block(&[("culture", Scope(Scopes::Culture)), ("value", CompareValue)]),
1740    ),
1741    (
1742        Scopes::State,
1743        "state_average_religion_pop_acceptance",
1744        Block(&[("religion", Scope(Scopes::Religion)), ("value", CompareValue)]),
1745    ),
1746    (
1747        Scopes::State,
1748        "state_cultural_acceptance",
1749        Block(&[("target", Scope(Scopes::Culture)), ("value", CompareValue)]),
1750    ),
1751    (
1752        Scopes::State,
1753        "state_exports",
1754        Block(&[
1755            ("?target", Scope(Scopes::State)),
1756            ("?goods", Item(Item::Goods)),
1757            ("value", CompareValue),
1758        ]),
1759    ),
1760    (Scopes::StateGoods, "state_goods_cheaper", CompareValue),
1761    (Scopes::StateGoods, "state_goods_consumption", CompareValue),
1762    (Scopes::StateGoods, "state_goods_delta", CompareValue),
1763    (Scopes::StateGoods, "state_goods_has_local_goods_shortage", Boolean),
1764    (Scopes::StateGoods, "state_goods_pricier", CompareValue),
1765    (Scopes::StateGoods, "state_goods_production", CompareValue),
1766    (
1767        Scopes::State,
1768        "state_has_building_group_levels",
1769        Block(&[("type", Item(Item::BuildingGroup)), ("value", CompareValue)]),
1770    ),
1771    (Scopes::State, "state_has_building_levels", CompareValue),
1772    (
1773        Scopes::State,
1774        "state_has_building_type_levels",
1775        Block(&[("target", Scope(Scopes::BuildingType)), ("value", CompareValue)]),
1776    ),
1777    (Scopes::State, "state_has_goods_shortage", Boolean),
1778    (Scopes::State, "state_has_national_awakening", Boolean),
1779    (
1780        Scopes::State,
1781        "state_imports",
1782        Block(&[
1783            ("?target", Scope(Scopes::State)),
1784            ("?goods", Item(Item::Goods)),
1785            ("value", CompareValue),
1786        ]),
1787    ),
1788    (Scopes::State, "state_is_eligible_as_mass_migration_target", Boolean),
1789    (Scopes::State, "state_population", CompareValue),
1790    (
1791        Scopes::State,
1792        "state_religious_acceptance",
1793        Block(&[("target", Scope(Scopes::Religion)), ("value", CompareValue)]),
1794    ),
1795    (
1796        Scopes::State,
1797        "state_trade",
1798        Block(&[
1799            ("?target", Scope(Scopes::State)),
1800            ("?goods", Item(Item::Goods)),
1801            ("value", CompareValue),
1802        ]),
1803    ),
1804    (Scopes::State, "state_unemployment_rate", CompareValue),
1805    (Scopes::Pop, "strata", CompareChoice(STRATA)),
1806    (Scopes::Country, "subject_can_increase_autonomy", Boolean),
1807    (Scopes::Country, "supply_network_strength", CompareValue),
1808    (Scopes::Country, "supply_ship_maintenance_fulfillment", CompareValue),
1809    (Scopes::None, "switch", Special),
1810    (Scopes::Country, "taking_loans", Boolean),
1811    (Scopes::PowerBloc, "target_cohesion_number", CompareValue),
1812    (Scopes::PowerBloc, "target_cohesion_percentage", CompareValue),
1813    (Scopes::DiplomaticPlay, "target_is", Scope(Scopes::Country)),
1814    (Scopes::State, "tax_capacity", CompareValue),
1815    (Scopes::State, "tax_capacity_usage", CompareValue),
1816    (Scopes::Country, "tax_level", CompareChoice(LEVELS)),
1817    (Scopes::Country, "tax_level_value", CompareValue),
1818    (Scopes::Country, "tax_waste", CompareValue),
1819    (Scopes::Country, "tenure_in_current_power_bloc_days", CompareValue),
1820    (Scopes::Country, "tenure_in_current_power_bloc_months", CompareValue),
1821    (Scopes::Country, "tenure_in_current_power_bloc_weeks", CompareValue),
1822    (Scopes::Country, "tenure_in_current_power_bloc_years", CompareValue),
1823    (Scopes::Country, "total_manpower", Removed("1.6", "")),
1824    (Scopes::Country, "total_expenses", CompareValue),
1825    (Scopes::Country, "total_income", CompareValue),
1826    (Scopes::Country, "total_population", CompareValue),
1827    (Scopes::Country, "total_population_including_subjects", CompareValue),
1828    (Scopes::Country, "total_population_including_subjects_share", CompareValue),
1829    (Scopes::Country, "total_population_share", CompareValue),
1830    (Scopes::Pop, "total_size", CompareValue),
1831    (Scopes::State, "total_urbanization", CompareValue),
1832    (Scopes::PowerBloc, "total_used_principle_levels", CompareValue),
1833    (
1834        Scopes::None,
1835        "trade_route_needs_convoys_to_grow",
1836        Removed("1.9", "replaced with world market system"),
1837    ),
1838    (Scopes::Character, "trait_value", CompareValue),
1839    (Scopes::Country, "transfer_money_gross_income", CompareValue),
1840    (Scopes::Country, "transfer_money_net_income", CompareValue),
1841    (Scopes::None, "trigger_else", Control),
1842    (Scopes::None, "trigger_else_if", Control),
1843    (Scopes::None, "trigger_if", Control),
1844    (Scopes::State, "turmoil", CompareValue),
1845    (Scopes::NewCombatUnit, "unit_formation_has_commander", Scope(Scopes::Character)),
1846    // docs for all three say "target" instead of "value"
1847    (Scopes::PowerBloc, "used_principle_slots", CompareValue),
1848    (
1849        Scopes::None,
1850        "variable_list_size",
1851        Block(&[("name", Identifier("list name")), ("value", CompareValue)]),
1852    ),
1853    (Scopes::None, "variable_map_size", UncheckedTodo),
1854    (
1855        Scopes::War,
1856        "war_exhaustion_from_acceptance_of_dead",
1857        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1858    ),
1859    (Scopes::War, "war_has_active_peace_deal", Boolean),
1860    (
1861        Scopes::Country,
1862        "war_participant_has_war_goal_of_type_against",
1863        Block(&[("type", Item(Item::WarGoalType)), ("target", Scope(Scopes::Country))]),
1864    ),
1865    (
1866        Scopes::Country,
1867        "war_side_has_war_goal_of_type_against",
1868        Block(&[("type", Item(Item::WarGoalType)), ("target", Scope(Scopes::Country))]),
1869    ),
1870    (Scopes::Treaty, "was_coerced_with_naval_threat", Boolean),
1871    (Scopes::Character, "was_exiled", Boolean),
1872    (Scopes::Country, "was_formed_from", Item(Item::Country)),
1873    (Scopes::Pop, "wealth", CompareValue),
1874    // TODO: exactly one of pop_type, religion, or culture must be specified
1875    (
1876        Scopes::Country.union(Scopes::State),
1877        "wealth_share",
1878        Block(&[
1879            ("?pop_type", ScopeOrItem(Scopes::PopType, Item::PopType)),
1880            ("?religion", ScopeOrItem(Scopes::Religion, Item::Religion)),
1881            ("?culture", ScopeOrItem(Scopes::Culture, Item::Culture)),
1882            ("value", CompareValue),
1883        ]),
1884    ),
1885    (
1886        Scopes::Country,
1887        "weekly_net_fixed_income",
1888        Removed(
1889            "1.12",
1890            "Replaced with total_income, fixed_income, net_total_income, net_fixed_income",
1891        ),
1892    ),
1893    (Scopes::Building, "weekly_profit", CompareValue),
1894    (Scopes::None, "weighted_calc_true_if", Special),
1895    (Scopes::Pop, "workforce", CompareValue),
1896    (Scopes::State, "world_market_access", CompareValue),
1897    (Scopes::Goods, "world_market_delta", CompareValue),
1898    (Scopes::Goods, "world_market_exports", CompareValue),
1899    (Scopes::Goods, "world_market_imports", CompareValue),
1900    (
1901        Scopes::Country,
1902        "would_accept_diplomatic_action",
1903        Block(&[
1904            ("actor", Scope(Scopes::Country)),
1905            ("type", Item(Item::DiplomaticAction)),
1906            ("?first_state", Scope(Scopes::State)),
1907            ("?second_state", Scope(Scopes::State)),
1908            ("?modify_acceptance", SetValue),
1909        ]),
1910    ),
1911    (Scopes::InterestGroup, "would_sponsor_amendment", Scope(Scopes::AmendmentType)),
1912    (Scopes::None, "year", CompareValue),
1913    (Scopes::Character, "years_of_service", CompareValue),
1914    (
1915        Scopes::State,
1916        "years_to_incorporate",
1917        Block(&[("target", Scope(Scopes::Country)), ("value", CompareValue)]),
1918    ),
1919];
1920
1921#[inline]
1922pub fn scope_trigger_complex(name: &str) -> Option<(Scopes, ArgumentValue, Scopes)> {
1923    TRIGGER_COMPLEX_MAP.get(name).copied()
1924}
1925
1926static TRIGGER_COMPLEX_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, ArgumentValue, Scopes)>> =
1927    LazyLock::new(|| {
1928        let mut hash = TigerHashMap::default();
1929        for (from, s, trigger, outscopes) in TRIGGER_COMPLEX.iter().copied() {
1930            hash.insert(s, (from, trigger, outscopes));
1931        }
1932        hash
1933    });
1934
1935/// LAST UPDATED VIC3 VERSION 1.8.4
1936/// See `triggers.log` from the game data dumps
1937/// `(inscopes, trigger name, argtype, outscopes)`
1938/// Currently only works with single argument triggers
1939// TODO Update argtype when vic3 updated to 1.5+
1940const TRIGGER_COMPLEX: &[(Scopes, &str, ArgumentValue, Scopes)] = {
1941    use crate::item::Item;
1942    use ArgumentValue::*;
1943    &[
1944        (
1945            Scopes::Country,
1946            "additional_war_exhaustion",
1947            Scope(Scopes::DiplomaticPlay),
1948            Scopes::Value,
1949        ),
1950        (
1951            Scopes::Country,
1952            "army_mobilization_option_fraction",
1953            Item(Item::MobilizationOption),
1954            Scopes::Value,
1955        ),
1956        (Scopes::Country, "average_sol_for_culture", Scope(Scopes::Culture), Scopes::Value),
1957        (Scopes::Country, "average_sol_for_religion", Scope(Scopes::Religion), Scopes::Value),
1958        (Scopes::Character, "character_acceptance", Scope(Scopes::Country), Scopes::Value),
1959        (
1960            Scopes::Country,
1961            "country_army_unit_type_fraction",
1962            Scope(Scopes::CombatUnitType),
1963            Scopes::Value,
1964        ),
1965        (
1966            Scopes::Country,
1967            "country_average_cultural_acceptance",
1968            Scope(Scopes::Culture),
1969            Scopes::Value,
1970        ),
1971        (
1972            Scopes::Country,
1973            "country_average_culture_pop_acceptance",
1974            Scope(Scopes::Culture),
1975            Scopes::Value,
1976        ),
1977        (
1978            Scopes::Country,
1979            "country_average_religion_pop_acceptance",
1980            Scope(Scopes::Religion),
1981            Scopes::Value,
1982        ),
1983        (
1984            Scopes::Country,
1985            "country_average_religious_acceptance",
1986            Scope(Scopes::Religion),
1987            Scopes::Value,
1988        ),
1989        (
1990            Scopes::Country,
1991            "country_has_building_group_levels",
1992            ScopeOrItem(Scopes::BuildingGroup, Item::BuildingGroup),
1993            Scopes::Value,
1994        ),
1995        (
1996            Scopes::Country,
1997            "country_has_building_type_levels",
1998            ScopeOrItem(Scopes::BuildingType, Item::BuildingType),
1999            Scopes::Value,
2000        ),
2001        (Scopes::Country, "country_ship_type_fraction", Scope(Scopes::ShipType), Scopes::Value),
2002        (Scopes::Country, "cultural_acceptance_base", Scope(Scopes::Culture), Scopes::Value),
2003        (Scopes::State, "cultural_acceptance_delta", Scope(Scopes::Culture), Scopes::Value),
2004        (Scopes::Country, "culture_percent_country", Scope(Scopes::Culture), Scopes::Value),
2005        (Scopes::State, "culture_percent_state", Scope(Scopes::Culture), Scopes::Value),
2006        (Scopes::Culture, "culture_secession_progress", Scope(Scopes::Country), Scopes::Value),
2007        (
2008            Scopes::DiplomaticPact,
2009            "diplomatic_pact_other_country",
2010            Scope(Scopes::Country),
2011            Scopes::Country,
2012        ),
2013        (Scopes::Country, "economic_dependence", Scope(Scopes::Country), Scopes::Value),
2014        (Scopes::Country, "enactment_chance_for_law", Scope(Scopes::LawType), Scopes::Value),
2015        (
2016            Scopes::Country,
2017            "enactment_chance_for_law_without_enactment_modifier",
2018            Scope(Scopes::LawType),
2019            Scopes::Value,
2020        ),
2021        (Scopes::Country, "enemy_contested_wargoals", Scope(Scopes::War), Scopes::Value),
2022        (
2023            Scopes::MilitaryFormation,
2024            "formation_army_unit_type_fraction",
2025            Scope(Scopes::CombatUnitType),
2026            Scopes::Value,
2027        ),
2028        (
2029            Scopes::MilitaryFormation,
2030            "formation_navy_unit_type_fraction",
2031            Scope(Scopes::CombatUnitType),
2032            Scopes::Value,
2033        ),
2034        (
2035            Scopes::Building,
2036            "fraction_of_levels_owned_by_country",
2037            Scope(Scopes::Country),
2038            Scopes::Value,
2039        ),
2040        (Scopes::Country, "gdp_ownership_ratio", Scope(Scopes::Country), Scopes::Value),
2041        (Scopes::Country, "goods_production_rank", Scope(Scopes::Goods), Scopes::Value),
2042        (
2043            Scopes::HarvestCondition,
2044            "harvest_condition_intensity",
2045            Scope(Scopes::Country),
2046            Scopes::Value,
2047        ),
2048        (
2049            Scopes::Country,
2050            "has_strategic_region_interest_tier",
2051            Scope(Scopes::StrategicRegion),
2052            Scopes::Value,
2053        ),
2054        (Scopes::Country, "has_technology_progress", Item(Item::Technology), Scopes::Value),
2055        (Scopes::War, "has_war_exhaustion", Item(Item::Country), Scopes::Value),
2056        (Scopes::War, "has_war_support", Item(Item::Country), Scopes::Value),
2057        (
2058            Scopes::Country,
2059            "highest_overlapping_interest_tier",
2060            Scope(Scopes::Country),
2061            Scopes::Value,
2062        ),
2063        (Scopes::State, "ig_state_pol_strength_share", Scope(Scopes::InterestGroup), Scopes::Value),
2064        (Scopes::Country, "institution_investment_level", Item(Item::Institution), Scopes::Value),
2065        (Scopes::LawType, "law_progressiveness_difference", Scope(Scopes::LawType), Scopes::Value),
2066        (Scopes::PowerBloc, "leverage_advantage", Scope(Scopes::Country), Scopes::Value),
2067        (Scopes::None, "list_size", Identifier("list name"), Scopes::Value),
2068        (Scopes::Market, "market_consumption_share", Scope(Scopes::Country), Scopes::Value),
2069        (Scopes::Market, "market_exports", Scope(Scopes::Market), Scopes::Value),
2070        (Scopes::Market, "market_exports_reliance", Scope(Scopes::Market), Scopes::Value),
2071        (Scopes::Market, "market_imports", Scope(Scopes::Market), Scopes::Value),
2072        (Scopes::Market, "market_imports_reliance", Scope(Scopes::Market), Scopes::Value),
2073        (
2074            Scopes::Market,
2075            "market_number_goods_shortages_with",
2076            Scope(Scopes::Country),
2077            Scopes::Value,
2078        ),
2079        (
2080            Scopes::Market,
2081            "market_number_goods_shortages_without",
2082            Scope(Scopes::Country),
2083            Scopes::Value,
2084        ),
2085        (Scopes::Market, "market_production_share", Scope(Scopes::Country), Scopes::Value),
2086        (
2087            Scopes::PoliticalMovement,
2088            "movement_pressure",
2089            Scope(Scopes::InterestGroup),
2090            Scopes::Value,
2091        ),
2092        (Scopes::Country, "nationalization_cost", Scope(Scopes::Country), Scopes::Value),
2093        (Scopes::War, "num_country_casualties", Scope(Scopes::Country), Scopes::Value),
2094        (Scopes::War, "num_country_dead", Scope(Scopes::Country), Scopes::Value),
2095        (Scopes::War, "num_country_wounded", Scope(Scopes::Country), Scopes::Value),
2096        // TODO: check that the DiplomaticAction has a pact
2097        (Scopes::Country, "num_diplomatic_pacts", Item(Item::DiplomaticAction), Scopes::Value),
2098        // TODO: "will return an error if used on building types that are not level capped"
2099        (
2100            Scopes::State,
2101            "num_potential_resources",
2102            ScopeOrItem(Scopes::BuildingType, Item::BuildingType),
2103            Scopes::Value,
2104        ),
2105        (Scopes::Country, "pop_type_percent_country", Item(Item::PopType), Scopes::Value),
2106        (Scopes::State, "pop_type_percent_state", Scope(Scopes::PopType), Scopes::Value),
2107        (Scopes::State, "population_by_culture", Scope(Scopes::Culture), Scopes::Value),
2108        (
2109            Scopes::Country,
2110            "potential_diplomatic_play_power_ratio",
2111            Scope(Scopes::Country),
2112            Scopes::Value,
2113        ),
2114        (Scopes::Country, "religion_percent_country", Scope(Scopes::Religion), Scopes::Value),
2115        (Scopes::State, "religion_percent_state", Scope(Scopes::Religion), Scopes::Value),
2116        (Scopes::StateRegion, "remaining_undepleted", Item(Item::BuildingGroup), Scopes::Value),
2117        (Scopes::Country, "size_weighted_lost_battles_fraction", Scope(Scopes::War), Scopes::Value),
2118        (
2119            Scopes::State,
2120            "state_has_building_group_levels",
2121            Item(Item::BuildingGroup),
2122            Scopes::Value,
2123        ),
2124        (Scopes::State, "state_has_building_type_levels", Item(Item::BuildingType), Scopes::Value),
2125        (Scopes::Country, "power_bloc_share_gdp_with", Scope(Scopes::Country), Scopes::Value),
2126        (Scopes::Country, "power_bloc_share_gdp_without", Scope(Scopes::Country), Scopes::Value),
2127        (
2128            Scopes::Country,
2129            "power_bloc_share_power_projection_with",
2130            Scope(Scopes::Country),
2131            Scopes::Value,
2132        ),
2133        (
2134            Scopes::Country,
2135            "power_bloc_share_power_projection_without",
2136            Scope(Scopes::Country),
2137            Scopes::Value,
2138        ),
2139        (Scopes::Country, "power_bloc_share_prestige_with", Scope(Scopes::Country), Scopes::Value),
2140        (
2141            Scopes::Country,
2142            "power_bloc_share_prestige_without",
2143            Scope(Scopes::Country),
2144            Scopes::Value,
2145        ),
2146        (
2147            Scopes::PowerBloc,
2148            "power_bloc_total_leading_goods_producers_with",
2149            Scope(Scopes::Country),
2150            Scopes::Value,
2151        ),
2152        (
2153            Scopes::PowerBloc,
2154            "power_bloc_total_leading_goods_producers_without",
2155            Scope(Scopes::Country),
2156            Scopes::Value,
2157        ),
2158        (
2159            Scopes::PowerBloc,
2160            "power_bloc_worst_economic_dependence_with",
2161            Scope(Scopes::Country),
2162            Scopes::Value,
2163        ),
2164        (
2165            Scopes::PowerBloc,
2166            "power_bloc_worst_economic_dependence_without",
2167            Scope(Scopes::Country),
2168            Scopes::Value,
2169        ),
2170        (Scopes::PowerBloc, "power_bloc_worst_infamy_with", Scope(Scopes::Country), Scopes::Value),
2171        (
2172            Scopes::PowerBloc,
2173            "power_bloc_worst_infamy_without",
2174            Scope(Scopes::Country),
2175            Scopes::Value,
2176        ),
2177        (
2178            Scopes::PowerBloc,
2179            "power_bloc_worst_leader_relations_with",
2180            Scope(Scopes::Country),
2181            Scopes::Value,
2182        ),
2183        (
2184            Scopes::PowerBloc,
2185            "power_bloc_worst_leader_relations_without",
2186            Scope(Scopes::Country),
2187            Scopes::Value,
2188        ),
2189        (
2190            Scopes::PowerBloc,
2191            "power_bloc_worst_leader_religion_population_fraction_with",
2192            Scope(Scopes::Country),
2193            Scopes::Value,
2194        ),
2195        (
2196            Scopes::PowerBloc,
2197            "power_bloc_worst_leader_religion_population_fraction_without",
2198            Scope(Scopes::Country),
2199            Scopes::Value,
2200        ),
2201        (
2202            Scopes::PowerBloc,
2203            "power_bloc_worst_liberty_desire_with",
2204            Scope(Scopes::Country),
2205            Scopes::Value,
2206        ),
2207        (
2208            Scopes::PowerBloc,
2209            "power_bloc_worst_liberty_desire_without",
2210            Scope(Scopes::Country),
2211            Scopes::Value,
2212        ),
2213        (
2214            Scopes::PowerBloc,
2215            "power_bloc_worst_progressiveness_difference_government_type_with",
2216            Scope(Scopes::Country),
2217            Scopes::Value,
2218        ),
2219        (
2220            Scopes::PowerBloc,
2221            "power_bloc_worst_progressiveness_difference_government_type_without",
2222            Scope(Scopes::Country),
2223            Scopes::Value,
2224        ),
2225        (
2226            Scopes::PowerBloc,
2227            "predicted_cohesion_percentage_with",
2228            Scope(Scopes::Country),
2229            Scopes::Value,
2230        ),
2231        (Scopes::Country, "region_score", Scope(Scopes::StrategicRegion), Scopes::Value),
2232        (
2233            Scopes::JournalEntry,
2234            "scripted_bar_progress",
2235            Item(Item::ScriptedProgressBar),
2236            Scopes::Value,
2237        ),
2238        (
2239            Scopes::Country,
2240            "ship_modification_market_demand_ratio",
2241            Scope(Scopes::ShipModificationType),
2242            Scopes::Value,
2243        ),
2244        (Scopes::Country, "stall_chance_for_law", Scope(Scopes::LawType), Scopes::Value),
2245        (
2246            Scopes::Country,
2247            "stall_chance_for_law_without_enactment_modifier",
2248            Scope(Scopes::LawType),
2249            Scopes::Value,
2250        ),
2251        (
2252            Scopes::Country,
2253            "state_average_culture_pop_acceptance",
2254            Scope(Scopes::Culture),
2255            Scopes::Value,
2256        ),
2257        (
2258            Scopes::Country,
2259            "state_average_religion_pop_acceptance",
2260            Scope(Scopes::Religion),
2261            Scopes::Value,
2262        ),
2263        (Scopes::State, "state_cultural_acceptance", Scope(Scopes::Culture), Scopes::Value),
2264        (Scopes::State, "state_religious_acceptance", Scope(Scopes::Religion), Scopes::Value),
2265        (
2266            Scopes::War,
2267            "war_exhaustion_from_acceptance_of_dead",
2268            Scope(Scopes::Country),
2269            Scopes::Value,
2270        ),
2271        (Scopes::State, "years_to_incorporate", Scope(Scopes::Country), Scopes::Value),
2272    ]
2273};