tiger-lib 1.18.0

Library used by the tools ck3-tiger, vic3-tiger, and imperator-tiger. This library holds the bulk of the code for them. It can be built either for ck3-tiger with the feature ck3, or for vic3-tiger with the feature vic3, or for imperator-tiger with the feature imperator, but not both at the same time.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
use std::sync::LazyLock;

use crate::helpers::TigerHashMap;
use crate::scopes::{ArgumentValue, Scopes};

#[inline]
pub fn scope_to_scope(name: &str) -> Option<(Scopes, Scopes)> {
    SCOPE_TO_SCOPE_MAP.get(name).copied()
}

static SCOPE_TO_SCOPE_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Scopes)>> =
    LazyLock::new(|| {
        let mut hash = TigerHashMap::default();
        for (from, s, to) in SCOPE_TO_SCOPE.iter().copied() {
            hash.insert(s, (from, to));
        }
        hash
    });

/// LAST UPDATED CK3 VERSION 1.16.0
/// See `event_targets.log` from the game data dumps
/// These are scope transitions that can be chained like `root.joined_faction.faction_leader`
const SCOPE_TO_SCOPE: &[(Scopes, &str, Scopes)] = &[
    (Scopes::Accolade, "acclaimed_knight", Scopes::Character),
    (Scopes::Character, "accolade", Scopes::Accolade),
    (Scopes::Accolade, "accolade_owner", Scopes::Character),
    (Scopes::Accolade, "accolade_successor", Scopes::Character),
    (Scopes::Activity, "activity_host", Scopes::Character),
    (Scopes::Activity, "activity_location", Scopes::Province),
    (Scopes::Activity, "activity_type", Scopes::ActivityType),
    (Scopes::Character, "administrative_contract", Scopes::VassalContract),
    (Scopes::Character, "administrative_obligation", Scopes::VassalObligationLevel),
    (Scopes::Army, "army_commander", Scopes::Character),
    (Scopes::Army, "army_owner", Scopes::Character),
    (Scopes::Artifact, "artifact_age", Scopes::Value),
    (Scopes::Artifact, "artifact_owner", Scopes::Character),
    (Scopes::Character, "assigned_tax_slot", Scopes::TaxSlot),
    (Scopes::LandedTitle.union(Scopes::Province), "barony", Scopes::LandedTitle),
    (Scopes::LandedTitle.union(Scopes::Province), "barony_controller", Scopes::Character),
    (Scopes::Character, "betrothed", Scopes::Character),
    (Scopes::Culture, "calc_culture_dominant_faith", Scopes::Faith),
    (Scopes::Culture, "calc_culture_dominant_religion", Scopes::Religion),
    (Scopes::Character, "capital_barony", Scopes::LandedTitle),
    (Scopes::Character, "capital_county", Scopes::LandedTitle),
    (Scopes::Character, "capital_province", Scopes::Province),
    (Scopes::LandedTitle, "capital_vassal", Scopes::LandedTitle),
    (Scopes::War, "casus_belli", Scopes::CasusBelli),
    (Scopes::War.union(Scopes::CasusBelli), "claimant", Scopes::Character),
    (Scopes::CombatSide, "combat", Scopes::Combat),
    (Scopes::Combat, "combat_attacker", Scopes::CombatSide),
    (Scopes::Combat, "combat_defender", Scopes::CombatSide),
    (Scopes::Combat, "combat_war", Scopes::War),
    (Scopes::Character, "commanding_army", Scopes::Army),
    (Scopes::Value, "compare_value", Scopes::Value), // special
    (Scopes::Character, "concubinist", Scopes::Character),
    (Scopes::Character, "confederation", Scopes::Confederation),
    (Scopes::Confederation, "confederation_type", Scopes::ConfederationType),
    (Scopes::ProjectContribution, "contributor", Scopes::Character),
    (Scopes::Character, "council_owner", Scopes::Character),
    (Scopes::Character, "council_task", Scopes::CouncilTask), // also has a prefix form
    (Scopes::CouncilTask, "councillor", Scopes::Character),
    (Scopes::Character, "councillor_task_target", Scopes::all()), // output scope depends on task
    (Scopes::LandedTitle.union(Scopes::Province), "county", Scopes::LandedTitle),
    (Scopes::LandedTitle.union(Scopes::Province), "county_controller", Scopes::Character),
    (Scopes::Character, "court_owner", Scopes::Character),
    (Scopes::Artifact, "creator", Scopes::Character),
    (
        Scopes::Character.union(Scopes::LandedTitle).union(Scopes::Province),
        "culture",
        Scopes::Culture,
    ),
    (Scopes::Culture, "culture_head", Scopes::Character),
    (Scopes::LandedTitle, "current_heir", Scopes::Character),
    (Scopes::TravelPlan, "current_location", Scopes::Province),
    (Scopes::Legend, "current_or_last_legend_owner", Scopes::Character),
    (Scopes::Character, "current_travel_plan", Scopes::TravelPlan),
    (Scopes::LandedTitle, "de_facto_liege", Scopes::LandedTitle),
    (Scopes::LandedTitle, "de_jure_liege", Scopes::LandedTitle),
    (Scopes::Character, "default_location", Scopes::Province),
    (Scopes::TravelPlan, "departure_location", Scopes::Province),
    (Scopes::Character, "designated_diarch", Scopes::Character),
    (Scopes::Character, "designated_heir", Scopes::Character),
    (Scopes::Character, "diarch", Scopes::Character),
    (Scopes::Character, "diarchy_successor", Scopes::Character),
    (Scopes::Character, "domicile", Scopes::Domicile),
    (Scopes::Domicile, "domicile_culture", Scopes::Culture),
    (Scopes::Domicile, "domicile_faith", Scopes::Faith),
    (Scopes::Domicile, "domicile_location", Scopes::Province),
    (Scopes::LandedTitle.union(Scopes::Province), "duchy", Scopes::LandedTitle),
    (Scopes::Dynasty, "dynasty_founder", Scopes::Character),
    (Scopes::None, "dummy_female", Scopes::Character),
    (Scopes::None, "dummy_male", Scopes::Character),
    (Scopes::Dynasty, "dynast", Scopes::Character),
    (Scopes::Character, "dynasty", Scopes::Dynasty),
    (Scopes::LandedTitle.union(Scopes::Province), "empire", Scopes::LandedTitle),
    (Scopes::Character, "employer", Scopes::Character),
    (Scopes::CombatSide, "enemy_side", Scopes::CombatSide),
    (Scopes::EpidemicType, "epidemic_trait", Scopes::Trait),
    (Scopes::Epidemic, "epidemic_type", Scopes::EpidemicType),
    (Scopes::Faction, "faction_leader", Scopes::Character),
    (Scopes::Faction, "faction_target", Scopes::Character),
    (Scopes::Faction, "faction_war", Scopes::War),
    (
        Scopes::Character
            .union(Scopes::LandedTitle)
            .union(Scopes::Province)
            .union(Scopes::GreatHolyWar),
        "faith",
        Scopes::Faith,
    ),
    (Scopes::Character, "father", Scopes::Character),
    (Scopes::TravelPlan, "final_destination_province", Scopes::Province),
    (Scopes::Faith, "founder", Scopes::Character),
    (Scopes::Accolade, "founder_culture", Scopes::Culture),
    (Scopes::Accolade, "founder_dynasty", Scopes::Dynasty),
    (Scopes::Accolade, "founder_faith", Scopes::Faith),
    (Scopes::Accolade, "founder_house", Scopes::DynastyHouse),
    (Scopes::Character, "ghw_beneficiary", Scopes::Character),
    (Scopes::GreatHolyWar, "ghw_designated_winner", Scopes::Character),
    (Scopes::GreatHolyWar, "ghw_target_character", Scopes::Character),
    (Scopes::GreatHolyWar, "ghw_target_title", Scopes::LandedTitle),
    (Scopes::GreatHolyWar, "ghw_title_recipient", Scopes::Character),
    (Scopes::GreatHolyWar, "ghw_war", Scopes::War),
    (Scopes::GreatHolyWar, "ghw_war_declarer", Scopes::Character),
    (Scopes::Character, "government_type", Scopes::GovernmentType),
    (Scopes::Faith, "great_holy_war", Scopes::GreatHolyWar),
    (Scopes::ProjectContribution, "great_project", Scopes::GreatProject),
    (Scopes::GreatProject, "great_project_founder", Scopes::Character),
    (Scopes::GreatProject, "great_project_location", Scopes::Province),
    (Scopes::GreatProject, "great_project_owner", Scopes::Character),
    // Overridden by the trigger of the same name
    // (Scopes::GreatProject, "great_project_type", Scopes::GreatProjectType),
    (Scopes::LandedTitle.union(Scopes::Province), "hegemony", Scopes::LandedTitle),
    (Scopes::LandedTitle, "holder", Scopes::Character),
    (Scopes::Province, "holding_type", Scopes::HoldingType),
    (Scopes::HolyOrder, "holy_order_patron", Scopes::Character),
    (Scopes::Character, "home_court", Scopes::Character),
    (Scopes::Character, "host", Scopes::Character),
    (Scopes::Character, "house", Scopes::DynastyHouse),
    (Scopes::DynastyHouse, "house_aspiration", Scopes::HouseAspiration),
    (Scopes::DynastyHouse, "house_confederation", Scopes::Confederation),
    (Scopes::DynastyHouse, "house_dynasty", Scopes::Dynasty),
    (Scopes::DynastyHouse, "house_founder", Scopes::Character),
    (Scopes::DynastyHouse, "house_head", Scopes::Character),
    (Scopes::Character, "imprisoner", Scopes::Character),
    (Scopes::Accolade, "initial_type", Scopes::AccoladeType),
    (Scopes::Character, "inspiration", Scopes::Inspiration),
    (Scopes::Inspiration, "inspiration_owner", Scopes::Character),
    (Scopes::Inspiration, "inspiration_sponsor", Scopes::Character),
    (Scopes::Character, "intent_target", Scopes::Character),
    (Scopes::Character, "involved_activity", Scopes::Activity),
    (Scopes::Army, "involved_combat_side", Scopes::CombatSide),
    (Scopes::Character, "joined_faction", Scopes::Faction),
    (Scopes::Character, "killer", Scopes::Character),
    (Scopes::LandedTitle.union(Scopes::Province), "kingdom", Scopes::LandedTitle),
    (Scopes::Character, "knight_army", Scopes::Army),
    (Scopes::DynastyHouse, "last_house_head", Scopes::Character),
    (Scopes::Character, "last_played_character", Scopes::Character),
    (Scopes::HolyOrder, "leader", Scopes::Character),
    (Scopes::Confederation, "leading_house", Scopes::DynastyHouse),
    (Scopes::Legend, "legend_owner", Scopes::Character),
    (Scopes::Legend, "legend_protagonist", Scopes::Character),
    (Scopes::Legend, "legend_type", Scopes::LegendType),
    (Scopes::LandedTitle, "lessee", Scopes::Character),
    (Scopes::LandedTitle, "lessee_title", Scopes::LandedTitle),
    (Scopes::Character, "liege", Scopes::Character),
    (Scopes::Character, "liege_or_court_owner", Scopes::Character),
    (Scopes::Character.union(Scopes::Combat).union(Scopes::Army), "location", Scopes::Province),
    (Scopes::Character, "matchmaker", Scopes::Character),
    (Scopes::MercenaryCompany, "mercenary_company_leader", Scopes::Character),
    (Scopes::CharacterMemory, "memory_owner", Scopes::Character),
    (Scopes::Character, "mother", Scopes::Character),
    // named_script_value special
    (Scopes::TravelPlan, "next_destination_province", Scopes::Province),
    (Scopes::TravelPlan, "next_location", Scopes::Province),
    (Scopes::None, "no", Scopes::Bool),
    (Scopes::Character, "obedience_target", Scopes::Character),
    (Scopes::Epidemic, "outbreak_province", Scopes::Province),
    (Scopes::Character, "overlord", Scopes::Character),
    (Scopes::Domicile, "owner", Scopes::Character),
    (Scopes::SituationParticipantGroup, "participant_group_situation", Scopes::Situation),
    (Scopes::SituationParticipantGroup, "participant_group_sub_region", Scopes::SituationSubRegion),
    (Scopes::Character, "player_heir", Scopes::Character),
    (Scopes::Character, "pregnancy_assumed_father", Scopes::Character),
    (Scopes::Character, "pregnancy_real_father", Scopes::Character),
    // "prev" special
    (Scopes::LandedTitle, "previous_holder", Scopes::Character),
    (Scopes::Artifact, "previous_owner", Scopes::Character),
    (Scopes::Artifact, "previous_owner_level_2", Scopes::Character),
    (Scopes::Artifact, "previous_owner_level_3", Scopes::Character),
    (Scopes::War.union(Scopes::CasusBelli), "primary_attacker", Scopes::Character),
    (Scopes::War.union(Scopes::CasusBelli), "primary_defender", Scopes::Character),
    (Scopes::Character, "primary_heir", Scopes::Character),
    (Scopes::Character, "primary_partner", Scopes::Character),
    (Scopes::Character, "primary_spouse", Scopes::Character),
    (Scopes::Character, "primary_title", Scopes::LandedTitle),
    (Scopes::Character, "promoted_legend", Scopes::Legend),
    (Scopes::Province, "province_owner", Scopes::Character),
    (Scopes::Character, "real_father", Scopes::Character),
    (Scopes::Character, "real_mother", Scopes::Character),
    (Scopes::Character, "realm_priest", Scopes::Character),
    (
        Scopes::Character
            .union(Scopes::LandedTitle)
            .union(Scopes::Province)
            .union(Scopes::Faith)
            .union(Scopes::GreatHolyWar),
        "religion",
        Scopes::Religion,
    ),
    (Scopes::Faith, "religious_head", Scopes::Character),
    (Scopes::Faith, "religious_head_title", Scopes::LandedTitle),
    (Scopes::Regiment, "regiment_controller", Scopes::Character),
    (Scopes::Regiment, "regiment_controlling_title", Scopes::LandedTitle),
    (Scopes::Regiment, "regiment_owner", Scopes::Character),
    (Scopes::Regiment, "regiment_owning_title", Scopes::LandedTitle),
    (Scopes::Regiment, "regiment_station", Scopes::Province),
    // "root" special
    (Scopes::TaskContract, "scheme", Scopes::Scheme),
    (Scopes::Scheme, "scheme_artifact", Scopes::Artifact),
    (Scopes::Scheme, "scheme_defender", Scopes::Character),
    (Scopes::Scheme, "scheme_owner", Scopes::Character),
    (Scopes::Scheme, "scheme_target_character", Scopes::Character),
    (Scopes::Scheme, "scheme_target_culture", Scopes::Culture),
    (Scopes::Scheme, "scheme_target_faith", Scopes::Faith),
    (Scopes::Scheme, "scheme_target_title", Scopes::LandedTitle),
    (Scopes::Character, "secret_faith", Scopes::Faith),
    (Scopes::Secret, "secret_owner", Scopes::Character),
    (Scopes::Secret, "secret_target", Scopes::Character),
    (Scopes::CombatSide, "side_commander", Scopes::Character),
    (Scopes::CombatSide, "side_primary_participant", Scopes::Character),
    (Scopes::Situation, "situation_center_province", Scopes::Province),
    (Scopes::Situation, "situation_top_barter_goods", Scopes::Character),
    (Scopes::Situation, "situation_top_gold", Scopes::Character),
    (Scopes::Situation, "situation_top_herd", Scopes::Character),
    (Scopes::Situation, "situation_top_provisions", Scopes::Character),
    (Scopes::Situation, "situation_top_sub_region", Scopes::SituationSubRegion),
    (Scopes::AgentSlot, "slot_character", Scopes::Character),
    (Scopes::Faction, "special_character", Scopes::Character),
    (Scopes::Faction, "special_title", Scopes::LandedTitle),
    (Scopes::LandedTitle, "state_faith", Scopes::Faith),
    (Scopes::StoryCycle, "story_owner", Scopes::Character),
    (Scopes::VassalObligationLevel, "subject_contract_type", Scopes::VassalContract),
    (Scopes::Character, "suzerain", Scopes::Character),
    (Scopes::Scheme, "task_contract", Scopes::TaskContract),
    (Scopes::TaskContract, "task_contract_destination", Scopes::Province),
    (Scopes::TaskContract, "task_contract_employer", Scopes::Character),
    (Scopes::TaskContract, "task_contract_location", Scopes::Province),
    (Scopes::TaskContract, "task_contract_taker", Scopes::Character),
    (Scopes::TaskContract, "task_contract_target", Scopes::Character),
    // "this" special
    (Scopes::TaxSlot, "tax_collector", Scopes::Character),
    (Scopes::Character, "tax_slot", Scopes::TaxSlot),
    (Scopes::TaxSlot, "tax_slot_liege", Scopes::Character),
    (Scopes::HolyOrder, "title", Scopes::LandedTitle),
    (Scopes::LandedTitle, "title_capital_county", Scopes::LandedTitle),
    (Scopes::LandedTitle, "title_domicile", Scopes::Domicile),
    (Scopes::LandedTitle, "title_province", Scopes::Province),
    (Scopes::TravelPlan, "travel_leader", Scopes::Character),
    (Scopes::TravelPlan, "travel_plan_activity", Scopes::Activity),
    (Scopes::TravelPlan, "travel_plan_owner", Scopes::Character),
    (Scopes::Character, "top_liege", Scopes::Character),
    (Scopes::Character, "top_overlord", Scopes::Character),
    (Scopes::Character, "top_suzerain", Scopes::Character),
    // "value" special
    (Scopes::VassalObligationLevel, "vassal_contract_type", Scopes::VassalContract),
    (Scopes::Character, "vassal_tax_collector", Scopes::Character),
    (Scopes::CasusBelli, "war", Scopes::War),
    (Scopes::Character, "warden", Scopes::Character),
    (Scopes::None, "yes", Scopes::Bool),
];

#[inline]
pub fn scope_prefix(name: &str) -> Option<(Scopes, Scopes, ArgumentValue)> {
    SCOPE_PREFIX_MAP.get(name).copied()
}

static SCOPE_PREFIX_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Scopes, ArgumentValue)>> =
    LazyLock::new(|| {
        let mut hash = TigerHashMap::default();
        for (from, s, to, argument) in SCOPE_PREFIX.iter().copied() {
            hash.insert(s, (from, to, argument));
        }
        hash
    });

/// LAST UPDATED CK3 VERSION 1.18.0
/// See `event_targets.log` from the game data dumps
/// These are absolute scopes (like character:100000) and scope transitions that require
/// a key (like `root.cp:councillor_steward`)
const SCOPE_PREFIX: &[(Scopes, &str, Scopes, ArgumentValue)] = {
    use crate::item::Item;
    use crate::scopes::ArgumentValue::*;
    &[
        (Scopes::None, "accolade_type", Scopes::AccoladeType, Item(Item::AccoladeType)),
        (Scopes::None, "activity_type", Scopes::ActivityType, Item(Item::ActivityType)),
        (Scopes::Character, "aptitude", Scopes::Value, Item(Item::CourtPosition)),
        (Scopes::Character, "aptitude_score", Scopes::Value, Item(Item::CourtPosition)),
        (
            Scopes::Army,
            "army_number_maa_regiments_of_base_type",
            Scopes::Value,
            Item(Item::MenAtArmsBase),
        ),
        (Scopes::Army, "army_number_maa_regiments_of_type", Scopes::Value, Item(Item::MenAtArms)),
        (Scopes::None, "array_define", Scopes::Value, UncheckedValue),
        (Scopes::None, "casus_belli_type", Scopes::CasusBelliType, Item(Item::CasusBelli)),
        (Scopes::None, "character", Scopes::Character, Item(Item::Character)),
        (
            Scopes::SituationSubRegion,
            "character_participant_group",
            Scopes::SituationParticipantGroup,
            Scope(Scopes::Character),
        ),
        (
            Scopes::None,
            "confederation_type",
            Scopes::ConfederationType,
            Item(Item::ConfederationType),
        ),
        (Scopes::None, "contract_type", Scopes::VassalContract, Item(Item::SubjectContract)),
        (Scopes::Character, "council_task", Scopes::CouncilTask, Item(Item::CouncilPosition)),
        (Scopes::Character, "court_position", Scopes::Character, Item(Item::CourtPosition)),
        (Scopes::None, "court_position_type", Scopes::CourtPositionType, Item(Item::CourtPosition)),
        (Scopes::Character, "cp", Scopes::Character, Item(Item::CouncilPosition)), // councillor
        (Scopes::None, "culture", Scopes::Culture, Item(Item::Culture)),
        (Scopes::None, "culture_innovation", Scopes::CultureInnovation, Item(Item::Innovation)),
        (Scopes::None, "culture_pillar", Scopes::CulturePillar, Item(Item::CulturePillar)),
        (Scopes::None, "culture_tradition", Scopes::CultureTradition, Item(Item::CultureTradition)),
        (Scopes::Character, "dead_var", Scopes::all(), UncheckedValue),
        (Scopes::None, "decision", Scopes::Decision, Item(Item::Decision)),
        (Scopes::None, "define", Scopes::Value, UncheckedValue),
        (Scopes::None, "doctrine", Scopes::Doctrine, Item(Item::Doctrine)),
        (Scopes::None, "dynasty", Scopes::Dynasty, Item(Item::Dynasty)),
        (Scopes::None, "epidemic_type", Scopes::EpidemicType, Item(Item::EpidemicType)),
        (Scopes::None, "event_id", Scopes::Flag, Item(Item::Event)),
        (Scopes::None, "faith", Scopes::Faith, Item(Item::Faith)),
        (Scopes::None, "flag", Scopes::Flag, UncheckedValue),
        (Scopes::None, "geographical_region", Scopes::GeographicalRegion, Item(Item::Region)),
        (Scopes::None, "global_var", Scopes::all(), UncheckedValue),
        (Scopes::None, "government_type", Scopes::GovernmentType, Item(Item::GovernmentType)),
        (
            Scopes::None,
            "great_project_type",
            Scopes::GreatProjectType,
            Item(Item::GreatProjectType),
        ),
        (Scopes::None, "holding_type", Scopes::HoldingType, Item(Item::GovernmentType)),
        (Scopes::None, "house", Scopes::DynastyHouse, Item(Item::House)),
        (Scopes::None, "house_aspiration", Scopes::HouseAspiration, Item(Item::HouseAspiration)),
        (
            Scopes::None,
            "house_relation_level",
            Scopes::HouseRelationLevel,
            Item(Item::HouseRelationLevel),
        ),
        (
            Scopes::None,
            "house_relation_type",
            Scopes::HouseRelationType,
            Item(Item::HouseRelationType),
        ),
        (Scopes::Legend, "legend_property", Scopes::all(), Item(Item::LegendProperty)),
        (Scopes::None, "legend_type", Scopes::LegendType, Item(Item::LegendType)),
        (Scopes::None, "list_size", Scopes::Value, UncheckedValue),
        (Scopes::None, "local_var", Scopes::all(), UncheckedValue),
        (
            Scopes::Character,
            "mandate_type_qualification",
            Scopes::Value,
            Item(Item::DiarchyMandate),
        ),
        (
            Scopes::Character,
            "max_number_maa_soldiers_of_base_type",
            Scopes::Value,
            Item(Item::MenAtArmsBase),
        ),
        (
            Scopes::Character,
            "max_number_maa_soldiers_of_type",
            Scopes::Value,
            Item(Item::MenAtArms),
        ),
        (Scopes::CharacterMemory, "memory_participant", Scopes::Character, UncheckedValue),
        (
            Scopes::Culture,
            "num_discovered_innovations_in_era",
            Scopes::Value,
            Item(Item::CultureEra),
        ),
        (
            Scopes::Character,
            "number_maa_regiments_of_base_type",
            Scopes::Value,
            Item(Item::MenAtArmsBase),
        ),
        (Scopes::Character, "number_maa_regiments_of_type", Scopes::Value, Item(Item::MenAtArms)),
        (
            Scopes::Character,
            "number_maa_soldiers_of_base_type",
            Scopes::Value,
            Item(Item::MenAtArmsBase),
        ),
        (Scopes::Character, "number_maa_soldiers_of_type", Scopes::Value, Item(Item::MenAtArms)),
        (
            Scopes::VassalContract,
            "obligation",
            Scopes::VassalObligationLevel,
            Item(Item::SubjectContractObligationLevel),
        ),
        (Scopes::None, "province", Scopes::Province, Item(Item::Province)),
        (Scopes::None, "religion", Scopes::Religion, Item(Item::Religion)),
        (Scopes::None, "scope", Scopes::all(), UncheckedValue),
        // TODO: "only available if the situation has is_unique = yes"
        (Scopes::None, "situation", Scopes::Situation, Item(Item::Situation)),
        (
            Scopes::Situation,
            "situation_participant_group",
            Scopes::SituationParticipantGroup,
            Item(Item::SituationParticipantGroup),
        ),
        (
            Scopes::Situation,
            "situation_sub_region",
            Scopes::SituationSubRegion,
            Item(Item::SituationSubRegion),
        ),
        (
            Scopes::Situation,
            "situation_top_participant_group",
            Scopes::SituationParticipantGroup,
            Scope(Scopes::Character),
        ),
        (Scopes::Activity, "special_guest", Scopes::Character, Item(Item::SpecialGuest)),
        (Scopes::Character, "story", Scopes::StoryCycle, Removed("1.18", "")),
        (Scopes::None, "struggle", Scopes::Struggle, Item(Item::Struggle)),
        (
            Scopes::SituationSubRegion,
            "sub_region_participant_group",
            Scopes::SituationParticipantGroup,
            Item(Item::SituationParticipantGroup),
        ),
        (
            Scopes::None,
            "task_contract_type",
            Scopes::TaskContractType,
            Item(Item::TaskContractType),
        ),
        (Scopes::Character, "tax_collector_aptitude", Scopes::Value, Item(Item::TaxSlotType)),
        (Scopes::None, "title", Scopes::LandedTitle, Item(Item::Title)),
        (
            Scopes::Character,
            "top_participant_group",
            Scopes::SituationParticipantGroup,
            Item(Item::Situation),
        ),
        (Scopes::None, "trait", Scopes::Trait, Item(Item::Trait)),
        (Scopes::all(), "var", Scopes::all(), UncheckedValue),
        (Scopes::None, "vassal_contract", Scopes::VassalContract, Item(Item::SubjectContract)),
        (
            Scopes::Character,
            "vassal_contract_obligation_level",
            Scopes::Value,
            Item(Item::SubjectContract),
        ),
    ]
};

pub fn scope_to_scope_removed(name: &str) -> Option<(&'static str, &'static str)> {
    for (removed_name, version, explanation) in SCOPE_TO_SCOPE_REMOVED.iter().copied() {
        if name == removed_name {
            return Some((version, explanation));
        }
    }
    None
}

const SCOPE_TO_SCOPE_REMOVED: &[(&str, &str, &str)] = &[
    ("activity", "1.9", ""),
    ("activity_owner", "1.9", "replaced by `activity_host`"),
    ("activity_province", "1.9", "replaced by `activity_location`"),
    ("scheme_target", "1.13", "replaced by `scheme_target_character`"),
    ("house_power", "1.19", "replaced by `house_aspiration`"),
    ("primary_type", "1.19", ""),
    ("secondary_type", "1.19", ""),
];