tiger_lib/ck3/tables/
targets.rs

1use std::sync::LazyLock;
2
3use crate::helpers::TigerHashMap;
4use crate::scopes::{ArgumentValue, Scopes};
5
6#[inline]
7pub fn scope_to_scope(name: &str) -> Option<(Scopes, Scopes)> {
8    SCOPE_TO_SCOPE_MAP.get(name).copied()
9}
10
11static SCOPE_TO_SCOPE_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Scopes)>> =
12    LazyLock::new(|| {
13        let mut hash = TigerHashMap::default();
14        for (from, s, to) in SCOPE_TO_SCOPE.iter().copied() {
15            hash.insert(s, (from, to));
16        }
17        hash
18    });
19
20/// LAST UPDATED CK3 VERSION 1.16.0
21/// See `event_targets.log` from the game data dumps
22/// These are scope transitions that can be chained like `root.joined_faction.faction_leader`
23const SCOPE_TO_SCOPE: &[(Scopes, &str, Scopes)] = &[
24    (Scopes::Accolade, "acclaimed_knight", Scopes::Character),
25    (Scopes::Character, "accolade", Scopes::Accolade),
26    (Scopes::Accolade, "accolade_owner", Scopes::Character),
27    (Scopes::Accolade, "accolade_successor", Scopes::Character),
28    (Scopes::Activity, "activity_host", Scopes::Character),
29    (Scopes::Activity, "activity_location", Scopes::Province),
30    (Scopes::Activity, "activity_type", Scopes::ActivityType),
31    (Scopes::Character, "administrative_contract", Scopes::VassalContract),
32    (Scopes::Character, "administrative_obligation", Scopes::VassalObligationLevel),
33    (Scopes::Army, "army_commander", Scopes::Character),
34    (Scopes::Army, "army_owner", Scopes::Character),
35    (Scopes::Artifact, "artifact_age", Scopes::Value),
36    (Scopes::Artifact, "artifact_owner", Scopes::Character),
37    (Scopes::Character, "assigned_tax_slot", Scopes::TaxSlot),
38    (Scopes::LandedTitle.union(Scopes::Province), "barony", Scopes::LandedTitle),
39    (Scopes::LandedTitle.union(Scopes::Province), "barony_controller", Scopes::Character),
40    (Scopes::Character, "betrothed", Scopes::Character),
41    (Scopes::Culture, "calc_culture_dominant_faith", Scopes::Faith),
42    (Scopes::Culture, "calc_culture_dominant_religion", Scopes::Religion),
43    (Scopes::Character, "capital_barony", Scopes::LandedTitle),
44    (Scopes::Character, "capital_county", Scopes::LandedTitle),
45    (Scopes::Character, "capital_province", Scopes::Province),
46    (Scopes::LandedTitle, "capital_vassal", Scopes::LandedTitle),
47    (Scopes::War, "casus_belli", Scopes::CasusBelli),
48    (Scopes::War.union(Scopes::CasusBelli), "claimant", Scopes::Character),
49    (Scopes::CombatSide, "combat", Scopes::Combat),
50    (Scopes::Combat, "combat_attacker", Scopes::CombatSide),
51    (Scopes::Combat, "combat_defender", Scopes::CombatSide),
52    (Scopes::Combat, "combat_war", Scopes::War),
53    (Scopes::Character, "commanding_army", Scopes::Army),
54    (Scopes::Value, "compare_value", Scopes::Value), // special
55    (Scopes::Character, "concubinist", Scopes::Character),
56    (Scopes::Character, "confederation", Scopes::Confederation),
57    (Scopes::Confederation, "confederation_type", Scopes::ConfederationType),
58    (Scopes::ProjectContribution, "contributor", Scopes::Character),
59    (Scopes::Character, "council_owner", Scopes::Character),
60    (Scopes::Character, "council_task", Scopes::CouncilTask), // also has a prefix form
61    (Scopes::CouncilTask, "councillor", Scopes::Character),
62    (Scopes::Character, "councillor_task_target", Scopes::all()), // output scope depends on task
63    (Scopes::LandedTitle.union(Scopes::Province), "county", Scopes::LandedTitle),
64    (Scopes::LandedTitle.union(Scopes::Province), "county_controller", Scopes::Character),
65    (Scopes::Character, "court_owner", Scopes::Character),
66    (Scopes::Artifact, "creator", Scopes::Character),
67    (
68        Scopes::Character.union(Scopes::LandedTitle).union(Scopes::Province),
69        "culture",
70        Scopes::Culture,
71    ),
72    (Scopes::Culture, "culture_head", Scopes::Character),
73    (Scopes::LandedTitle, "current_heir", Scopes::Character),
74    (Scopes::TravelPlan, "current_location", Scopes::Province),
75    (Scopes::Legend, "current_or_last_legend_owner", Scopes::Character),
76    (Scopes::Character, "current_travel_plan", Scopes::TravelPlan),
77    (Scopes::LandedTitle, "de_facto_liege", Scopes::LandedTitle),
78    (Scopes::LandedTitle, "de_jure_liege", Scopes::LandedTitle),
79    (Scopes::Character, "default_location", Scopes::Province),
80    (Scopes::TravelPlan, "departure_location", Scopes::Province),
81    (Scopes::Character, "designated_diarch", Scopes::Character),
82    (Scopes::Character, "designated_heir", Scopes::Character),
83    (Scopes::Character, "diarch", Scopes::Character),
84    (Scopes::Character, "diarchy_successor", Scopes::Character),
85    (Scopes::Character, "domicile", Scopes::Domicile),
86    (Scopes::Domicile, "domicile_culture", Scopes::Culture),
87    (Scopes::Domicile, "domicile_faith", Scopes::Faith),
88    (Scopes::Domicile, "domicile_location", Scopes::Province),
89    (Scopes::LandedTitle.union(Scopes::Province), "duchy", Scopes::LandedTitle),
90    (Scopes::Dynasty, "dynasty_founder", Scopes::Character),
91    (Scopes::None, "dummy_female", Scopes::Character),
92    (Scopes::None, "dummy_male", Scopes::Character),
93    (Scopes::Dynasty, "dynast", Scopes::Character),
94    (Scopes::Character, "dynasty", Scopes::Dynasty),
95    (Scopes::LandedTitle.union(Scopes::Province), "empire", Scopes::LandedTitle),
96    (Scopes::Character, "employer", Scopes::Character),
97    (Scopes::CombatSide, "enemy_side", Scopes::CombatSide),
98    (Scopes::EpidemicType, "epidemic_trait", Scopes::Trait),
99    (Scopes::Epidemic, "epidemic_type", Scopes::EpidemicType),
100    (Scopes::Faction, "faction_leader", Scopes::Character),
101    (Scopes::Faction, "faction_target", Scopes::Character),
102    (Scopes::Faction, "faction_war", Scopes::War),
103    (
104        Scopes::Character
105            .union(Scopes::LandedTitle)
106            .union(Scopes::Province)
107            .union(Scopes::GreatHolyWar),
108        "faith",
109        Scopes::Faith,
110    ),
111    (Scopes::Character, "father", Scopes::Character),
112    (Scopes::TravelPlan, "final_destination_province", Scopes::Province),
113    (Scopes::Faith, "founder", Scopes::Character),
114    (Scopes::Accolade, "founder_culture", Scopes::Culture),
115    (Scopes::Accolade, "founder_dynasty", Scopes::Dynasty),
116    (Scopes::Accolade, "founder_faith", Scopes::Faith),
117    (Scopes::Accolade, "founder_house", Scopes::DynastyHouse),
118    (Scopes::Character, "ghw_beneficiary", Scopes::Character),
119    (Scopes::GreatHolyWar, "ghw_designated_winner", Scopes::Character),
120    (Scopes::GreatHolyWar, "ghw_target_character", Scopes::Character),
121    (Scopes::GreatHolyWar, "ghw_target_title", Scopes::LandedTitle),
122    (Scopes::GreatHolyWar, "ghw_title_recipient", Scopes::Character),
123    (Scopes::GreatHolyWar, "ghw_war", Scopes::War),
124    (Scopes::GreatHolyWar, "ghw_war_declarer", Scopes::Character),
125    (Scopes::Character, "government_type", Scopes::GovernmentType),
126    (Scopes::Faith, "great_holy_war", Scopes::GreatHolyWar),
127    (Scopes::ProjectContribution, "great_project", Scopes::GreatProject),
128    (Scopes::GreatProject, "great_project_founder", Scopes::Character),
129    (Scopes::GreatProject, "great_project_location", Scopes::Province),
130    (Scopes::GreatProject, "great_project_owner", Scopes::Character),
131    // Overridden by the trigger of the same name
132    // (Scopes::GreatProject, "great_project_type", Scopes::GreatProjectType),
133    (Scopes::LandedTitle.union(Scopes::Province), "hegemony", Scopes::LandedTitle),
134    (Scopes::LandedTitle, "holder", Scopes::Character),
135    (Scopes::Province, "holding_type", Scopes::HoldingType),
136    (Scopes::HolyOrder, "holy_order_patron", Scopes::Character),
137    (Scopes::Character, "home_court", Scopes::Character),
138    (Scopes::Character, "host", Scopes::Character),
139    (Scopes::Character, "house", Scopes::DynastyHouse),
140    (Scopes::DynastyHouse, "house_confederation", Scopes::Confederation),
141    (Scopes::DynastyHouse, "house_dynasty", Scopes::Dynasty),
142    (Scopes::DynastyHouse, "house_founder", Scopes::Character),
143    (Scopes::DynastyHouse, "house_head", Scopes::Character),
144    // TODO: verify output scope type. Docs say house_aspiration which makes no sense
145    (Scopes::DynastyHouse, "house_power", Scopes::Value),
146    (Scopes::Character, "imprisoner", Scopes::Character),
147    (Scopes::Character, "inspiration", Scopes::Inspiration),
148    (Scopes::Inspiration, "inspiration_owner", Scopes::Character),
149    (Scopes::Inspiration, "inspiration_sponsor", Scopes::Character),
150    (Scopes::Character, "intent_target", Scopes::Character),
151    (Scopes::Character, "involved_activity", Scopes::Activity),
152    (Scopes::Army, "involved_combat_side", Scopes::CombatSide),
153    (Scopes::Character, "joined_faction", Scopes::Faction),
154    (Scopes::Character, "killer", Scopes::Character),
155    (Scopes::LandedTitle.union(Scopes::Province), "kingdom", Scopes::LandedTitle),
156    (Scopes::Character, "knight_army", Scopes::Army),
157    (Scopes::DynastyHouse, "last_house_head", Scopes::Character),
158    (Scopes::Character, "last_played_character", Scopes::Character),
159    (Scopes::HolyOrder, "leader", Scopes::Character),
160    (Scopes::Confederation, "leading_house", Scopes::DynastyHouse),
161    (Scopes::Legend, "legend_owner", Scopes::Character),
162    (Scopes::Legend, "legend_protagonist", Scopes::Character),
163    (Scopes::Legend, "legend_type", Scopes::LegendType),
164    (Scopes::LandedTitle, "lessee", Scopes::Character),
165    (Scopes::LandedTitle, "lessee_title", Scopes::LandedTitle),
166    (Scopes::Character, "liege", Scopes::Character),
167    (Scopes::Character, "liege_or_court_owner", Scopes::Character),
168    (Scopes::Character.union(Scopes::Combat).union(Scopes::Army), "location", Scopes::Province),
169    (Scopes::Character, "matchmaker", Scopes::Character),
170    (Scopes::MercenaryCompany, "mercenary_company_leader", Scopes::Character),
171    (Scopes::CharacterMemory, "memory_owner", Scopes::Character),
172    (Scopes::Character, "mother", Scopes::Character),
173    // named_script_value special
174    (Scopes::TravelPlan, "next_destination_province", Scopes::Province),
175    (Scopes::TravelPlan, "next_location", Scopes::Province),
176    (Scopes::None, "no", Scopes::Bool),
177    (Scopes::Character, "obedience_target", Scopes::Character),
178    (Scopes::Epidemic, "outbreak_province", Scopes::Province),
179    (Scopes::Character, "overlord", Scopes::Character),
180    (Scopes::Domicile, "owner", Scopes::Character),
181    (Scopes::SituationParticipantGroup, "participant_group_situation", Scopes::Situation),
182    (Scopes::SituationParticipantGroup, "participant_group_sub_region", Scopes::SituationSubRegion),
183    (Scopes::Character, "player_heir", Scopes::Character),
184    (Scopes::Character, "pregnancy_assumed_father", Scopes::Character),
185    (Scopes::Character, "pregnancy_real_father", Scopes::Character),
186    // "prev" special
187    (Scopes::LandedTitle, "previous_holder", Scopes::Character),
188    (Scopes::Artifact, "previous_owner", Scopes::Character),
189    (Scopes::Artifact, "previous_owner_level_2", Scopes::Character),
190    (Scopes::Artifact, "previous_owner_level_3", Scopes::Character),
191    (Scopes::War.union(Scopes::CasusBelli), "primary_attacker", Scopes::Character),
192    (Scopes::War.union(Scopes::CasusBelli), "primary_defender", Scopes::Character),
193    (Scopes::Character, "primary_heir", Scopes::Character),
194    (Scopes::Character, "primary_partner", Scopes::Character),
195    (Scopes::Character, "primary_spouse", Scopes::Character),
196    (Scopes::Character, "primary_title", Scopes::LandedTitle),
197    (Scopes::Accolade, "primary_type", Scopes::AccoladeType),
198    (Scopes::Character, "promoted_legend", Scopes::Legend),
199    (Scopes::Province, "province_owner", Scopes::Character),
200    (Scopes::Character, "real_father", Scopes::Character),
201    (Scopes::Character, "real_mother", Scopes::Character),
202    (Scopes::Character, "realm_priest", Scopes::Character),
203    (
204        Scopes::Character
205            .union(Scopes::LandedTitle)
206            .union(Scopes::Province)
207            .union(Scopes::Faith)
208            .union(Scopes::GreatHolyWar),
209        "religion",
210        Scopes::Religion,
211    ),
212    (Scopes::Faith, "religious_head", Scopes::Character),
213    (Scopes::Faith, "religious_head_title", Scopes::LandedTitle),
214    (Scopes::Regiment, "regiment_controller", Scopes::Character),
215    (Scopes::Regiment, "regiment_controlling_title", Scopes::LandedTitle),
216    (Scopes::Regiment, "regiment_owner", Scopes::Character),
217    (Scopes::Regiment, "regiment_owning_title", Scopes::LandedTitle),
218    (Scopes::Regiment, "regiment_station", Scopes::Province),
219    // "root" special
220    (Scopes::TaskContract, "scheme", Scopes::Scheme),
221    (Scopes::Scheme, "scheme_artifact", Scopes::Artifact),
222    (Scopes::Scheme, "scheme_defender", Scopes::Character),
223    (Scopes::Scheme, "scheme_owner", Scopes::Character),
224    (Scopes::Scheme, "scheme_target_character", Scopes::Character),
225    (Scopes::Scheme, "scheme_target_culture", Scopes::Culture),
226    (Scopes::Scheme, "scheme_target_faith", Scopes::Faith),
227    (Scopes::Scheme, "scheme_target_title", Scopes::LandedTitle),
228    (Scopes::Accolade, "secondary_type", Scopes::AccoladeType),
229    (Scopes::Character, "secret_faith", Scopes::Faith),
230    (Scopes::Secret, "secret_owner", Scopes::Character),
231    (Scopes::Secret, "secret_target", Scopes::Character),
232    (Scopes::CombatSide, "side_commander", Scopes::Character),
233    (Scopes::CombatSide, "side_primary_participant", Scopes::Character),
234    (Scopes::Situation, "situation_center_province", Scopes::Province),
235    (Scopes::Situation, "situation_top_barter_goods", Scopes::Character),
236    (Scopes::Situation, "situation_top_gold", Scopes::Character),
237    (Scopes::Situation, "situation_top_herd", Scopes::Character),
238    (Scopes::Situation, "situation_top_provisions", Scopes::Character),
239    (Scopes::Situation, "situation_top_sub_region", Scopes::SituationSubRegion),
240    (Scopes::AgentSlot, "slot_character", Scopes::Character),
241    (Scopes::Faction, "special_character", Scopes::Character),
242    (Scopes::Faction, "special_title", Scopes::LandedTitle),
243    (Scopes::LandedTitle, "state_faith", Scopes::Faith),
244    (Scopes::StoryCycle, "story_owner", Scopes::Character),
245    (Scopes::VassalObligationLevel, "subject_contract_type", Scopes::VassalContract),
246    (Scopes::Character, "suzerain", Scopes::Character),
247    (Scopes::Scheme, "task_contract", Scopes::TaskContract),
248    (Scopes::TaskContract, "task_contract_destination", Scopes::Province),
249    (Scopes::TaskContract, "task_contract_employer", Scopes::Character),
250    (Scopes::TaskContract, "task_contract_location", Scopes::Province),
251    (Scopes::TaskContract, "task_contract_taker", Scopes::Character),
252    (Scopes::TaskContract, "task_contract_target", Scopes::Character),
253    // "this" special
254    (Scopes::TaxSlot, "tax_collector", Scopes::Character),
255    (Scopes::Character, "tax_slot", Scopes::TaxSlot),
256    (Scopes::TaxSlot, "tax_slot_liege", Scopes::Character),
257    (Scopes::HolyOrder, "title", Scopes::LandedTitle),
258    (Scopes::LandedTitle, "title_capital_county", Scopes::LandedTitle),
259    (Scopes::LandedTitle, "title_domicile", Scopes::Domicile),
260    (Scopes::LandedTitle, "title_province", Scopes::Province),
261    (Scopes::TravelPlan, "travel_leader", Scopes::Character),
262    (Scopes::TravelPlan, "travel_plan_activity", Scopes::Activity),
263    (Scopes::TravelPlan, "travel_plan_owner", Scopes::Character),
264    (Scopes::Character, "top_liege", Scopes::Character),
265    (Scopes::Character, "top_overlord", Scopes::Character),
266    (Scopes::Character, "top_suzerain", Scopes::Character),
267    // "value" special
268    (Scopes::VassalObligationLevel, "vassal_contract_type", Scopes::VassalContract),
269    (Scopes::Character, "vassal_tax_collector", Scopes::Character),
270    (Scopes::CasusBelli, "war", Scopes::War),
271    (Scopes::Character, "warden", Scopes::Character),
272    (Scopes::None, "yes", Scopes::Bool),
273];
274
275#[inline]
276pub fn scope_prefix(name: &str) -> Option<(Scopes, Scopes, ArgumentValue)> {
277    SCOPE_PREFIX_MAP.get(name).copied()
278}
279
280static SCOPE_PREFIX_MAP: LazyLock<TigerHashMap<&'static str, (Scopes, Scopes, ArgumentValue)>> =
281    LazyLock::new(|| {
282        let mut hash = TigerHashMap::default();
283        for (from, s, to, argument) in SCOPE_PREFIX.iter().copied() {
284            hash.insert(s, (from, to, argument));
285        }
286        hash
287    });
288
289/// LAST UPDATED CK3 VERSION 1.18.0
290/// See `event_targets.log` from the game data dumps
291/// These are absolute scopes (like character:100000) and scope transitions that require
292/// a key (like `root.cp:councillor_steward`)
293const SCOPE_PREFIX: &[(Scopes, &str, Scopes, ArgumentValue)] = {
294    use crate::item::Item;
295    use crate::scopes::ArgumentValue::*;
296    &[
297        (Scopes::None, "accolade_type", Scopes::AccoladeType, Item(Item::AccoladeType)),
298        (Scopes::None, "activity_type", Scopes::ActivityType, Item(Item::ActivityType)),
299        (Scopes::Character, "aptitude", Scopes::Value, Item(Item::CourtPosition)),
300        (Scopes::Character, "aptitude_score", Scopes::Value, Item(Item::CourtPosition)),
301        (Scopes::None, "array_define", Scopes::Value, UncheckedValue),
302        (Scopes::None, "casus_belli_type", Scopes::CasusBelliType, Item(Item::CasusBelli)),
303        (Scopes::None, "character", Scopes::Character, Item(Item::Character)),
304        (
305            Scopes::SituationSubRegion,
306            "character_participant_group",
307            Scopes::SituationParticipantGroup,
308            Scope(Scopes::Character),
309        ),
310        (
311            Scopes::None,
312            "confederation_type",
313            Scopes::ConfederationType,
314            Item(Item::ConfederationType),
315        ),
316        (Scopes::None, "contract_type", Scopes::VassalContract, Item(Item::SubjectContract)),
317        (Scopes::Character, "council_task", Scopes::CouncilTask, Item(Item::CouncilPosition)),
318        (Scopes::Character, "court_position", Scopes::Character, Item(Item::CourtPosition)),
319        (Scopes::None, "court_position_type", Scopes::CourtPositionType, Item(Item::CourtPosition)),
320        (Scopes::Character, "cp", Scopes::Character, Item(Item::CouncilPosition)), // councillor
321        (Scopes::None, "culture", Scopes::Culture, Item(Item::Culture)),
322        (Scopes::None, "culture_innovation", Scopes::CultureInnovation, Item(Item::Innovation)),
323        (Scopes::None, "culture_pillar", Scopes::CulturePillar, Item(Item::CulturePillar)),
324        (Scopes::None, "culture_tradition", Scopes::CultureTradition, Item(Item::CultureTradition)),
325        (Scopes::Character, "dead_var", Scopes::all(), UncheckedValue),
326        (Scopes::None, "decision", Scopes::Decision, Item(Item::Decision)),
327        (Scopes::None, "define", Scopes::Value, UncheckedValue),
328        (Scopes::None, "doctrine", Scopes::Doctrine, Item(Item::Doctrine)),
329        (Scopes::None, "dynasty", Scopes::Dynasty, Item(Item::Dynasty)),
330        (Scopes::None, "epidemic_type", Scopes::EpidemicType, Item(Item::EpidemicType)),
331        (Scopes::None, "event_id", Scopes::Flag, Item(Item::Event)),
332        (Scopes::None, "faith", Scopes::Faith, Item(Item::Faith)),
333        (Scopes::None, "flag", Scopes::Flag, UncheckedValue),
334        (Scopes::None, "geographical_region", Scopes::GeographicalRegion, Item(Item::Region)),
335        (Scopes::None, "global_var", Scopes::all(), UncheckedValue),
336        (Scopes::None, "government_type", Scopes::GovernmentType, Item(Item::GovernmentType)),
337        (
338            Scopes::None,
339            "great_project_type",
340            Scopes::GreatProjectType,
341            Item(Item::GreatProjectType),
342        ),
343        (Scopes::None, "holding_type", Scopes::HoldingType, Item(Item::GovernmentType)),
344        (Scopes::None, "house", Scopes::DynastyHouse, Item(Item::House)),
345        (Scopes::None, "house_aspiration", Scopes::HouseAspiration, Item(Item::HouseAspiration)),
346        (
347            Scopes::None,
348            "house_relation_level",
349            Scopes::HouseRelationLevel,
350            Item(Item::HouseRelationLevel),
351        ),
352        (
353            Scopes::None,
354            "house_relation_type",
355            Scopes::HouseRelationType,
356            Item(Item::HouseRelationType),
357        ),
358        (Scopes::Legend, "legend_property", Scopes::all(), Item(Item::LegendProperty)),
359        (Scopes::None, "legend_type", Scopes::LegendType, Item(Item::LegendType)),
360        (Scopes::None, "list_size", Scopes::Value, UncheckedValue),
361        (Scopes::None, "local_var", Scopes::all(), UncheckedValue),
362        (
363            Scopes::Character,
364            "mandate_type_qualification",
365            Scopes::Value,
366            Item(Item::DiarchyMandate),
367        ),
368        (
369            Scopes::Character,
370            "max_number_maa_soldiers_of_base_type",
371            Scopes::Value,
372            Item(Item::MenAtArmsBase),
373        ),
374        (
375            Scopes::Character,
376            "max_number_maa_soldiers_of_type",
377            Scopes::Value,
378            Item(Item::MenAtArms),
379        ),
380        (Scopes::CharacterMemory, "memory_participant", Scopes::Character, UncheckedValue),
381        (
382            Scopes::Culture,
383            "num_discovered_innovations_in_era",
384            Scopes::Value,
385            Item(Item::CultureEra),
386        ),
387        (
388            Scopes::Character,
389            "number_maa_regiments_of_base_type",
390            Scopes::Value,
391            Item(Item::MenAtArmsBase),
392        ),
393        (Scopes::Character, "number_maa_regiments_of_type", Scopes::Value, Item(Item::MenAtArms)),
394        (
395            Scopes::Character,
396            "number_maa_soldiers_of_base_type",
397            Scopes::Value,
398            Item(Item::MenAtArmsBase),
399        ),
400        (Scopes::Character, "number_maa_soldiers_of_type", Scopes::Value, Item(Item::MenAtArms)),
401        (
402            Scopes::VassalContract,
403            "obligation",
404            Scopes::VassalObligationLevel,
405            Item(Item::SubjectContractObligationLevel),
406        ),
407        (Scopes::None, "province", Scopes::Province, Item(Item::Province)),
408        (Scopes::None, "religion", Scopes::Religion, Item(Item::Religion)),
409        (Scopes::None, "scope", Scopes::all(), UncheckedValue),
410        // TODO: "only available if the situation has is_unique = yes"
411        (Scopes::None, "situation", Scopes::Situation, Item(Item::Situation)),
412        (
413            Scopes::Situation,
414            "situation_participant_group",
415            Scopes::SituationParticipantGroup,
416            Item(Item::SituationParticipantGroup),
417        ),
418        (
419            Scopes::Situation,
420            "situation_sub_region",
421            Scopes::SituationSubRegion,
422            Item(Item::SituationSubRegion),
423        ),
424        (
425            Scopes::Situation,
426            "situation_top_participant_group",
427            Scopes::SituationParticipantGroup,
428            Scope(Scopes::Character),
429        ),
430        (Scopes::Activity, "special_guest", Scopes::Character, Item(Item::SpecialGuest)),
431        (Scopes::Character, "story", Scopes::StoryCycle, Removed("1.18", "")),
432        (Scopes::None, "struggle", Scopes::Struggle, Item(Item::Struggle)),
433        (
434            Scopes::SituationSubRegion,
435            "sub_region_participant_group",
436            Scopes::SituationParticipantGroup,
437            Item(Item::SituationParticipantGroup),
438        ),
439        (
440            Scopes::None,
441            "task_contract_type",
442            Scopes::TaskContractType,
443            Item(Item::TaskContractType),
444        ),
445        (Scopes::Character, "tax_collector_aptitude", Scopes::Value, Item(Item::TaxSlotType)),
446        (Scopes::None, "title", Scopes::LandedTitle, Item(Item::Title)),
447        (
448            Scopes::Character,
449            "top_participant_group",
450            Scopes::SituationParticipantGroup,
451            Item(Item::Situation),
452        ),
453        (Scopes::None, "trait", Scopes::Trait, Item(Item::Trait)),
454        (Scopes::all(), "var", Scopes::all(), UncheckedValue),
455        (Scopes::None, "vassal_contract", Scopes::VassalContract, Item(Item::SubjectContract)),
456        (
457            Scopes::Character,
458            "vassal_contract_obligation_level",
459            Scopes::Value,
460            Item(Item::SubjectContract),
461        ),
462    ]
463};
464
465pub fn scope_to_scope_removed(name: &str) -> Option<(&'static str, &'static str)> {
466    for (removed_name, version, explanation) in SCOPE_TO_SCOPE_REMOVED.iter().copied() {
467        if name == removed_name {
468            return Some((version, explanation));
469        }
470    }
471    None
472}
473
474const SCOPE_TO_SCOPE_REMOVED: &[(&str, &str, &str)] = &[
475    ("activity", "1.9", ""),
476    ("activity_owner", "1.9", "replaced by `activity_host`"),
477    ("activity_province", "1.9", "replaced by `activity_location`"),
478    ("scheme_target", "1.13", "replaced by `scheme_target_character`"),
479];